-1

I have a website that want to scrap www.tiketux.com And I want fill this form so I can get data in www.tiketux.com/book/pilihjadwal

I found this post data like this https://www.tiketux.com/book/pilihjadwal/post?agen=CPG&keberangkatan=0004&tujuan=153&jumpenumpang=1&datepicker=15%2F10%2F2014&idJurusan=153&kotaAsal=Bandung

In that page we can found the travel schedule I try using DOM and cURL but that data can't load,, Someone can help me how to get that data?

Thanks

1 Answers1

0
    $options = array(
        'http' => array(
            'header'  => "Content-type: text/html;charset=UTF-8\r\n",
            'method'  => 'POST',
            'content' => http_build_query([]),
        )
    );

    $context  = stream_context_create($options);

    $result = file_get_contents('https://www.tiketux.com/book/pilihjadwal/post?agen=CPG&keberangkatan=0004&tujuan=153&jumpenumpang=1&datepicker=15%2F10%2F2014&idJurusan=153&kotaAsal=Bandung', false, $context);

    $doc = new DOMDocument();
    @$doc->loadHTML($result);

$doc will be DOM-document from URL. Manual: http://php.net/manual/en/class.domdocument.php

John V
  • 875
  • 6
  • 12