我正尝试取消此网站(租车网站)的搜索结果:
我知道表单使用POST方法并重定向到:
http://www.movida.com.br/reserva/info
或源代码:loja=SAO+PAULO+-+CONGONHAS+AEROPORTO&loja_iata=CGH&cordx=-23.627531&cordy=-46.658859&data_retirada=18%2F07%2F2018&retirada2=07%2F18%2F2018&hora_retirada=10%3A00&data_devolucao=19%2F07%2F2018&devolucao2=07%2F19%2F2018&hora_devolucao=10%3A00&cupom=&hidden_loja=
当我尝试使用CURL和Simple_html_dom抓取数据时,它将返回一个空白/空白页面,或者返回到主页(movida.com.br)。我该如何解决?
请在下面找到PHP + CURL代码:
<?php
$link = "https://www.movida.com.br/reserva/info";
$post = 'loja=SAO+PAULO+-+CONGONHAS+AEROPORTO&loja_iata=CGH&cordx=-23.627531&cordy=-46.658859&data_retirada=18%2F07%2F2018&retirada2=07%2F18%2F2018&hora_retirada=10%3A00&data_devolucao=19%2F07%2F2018&devolucao2=07%2F19%2F2018&hora_devolucao=10%3A00&cupom=&hidden_loja=';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $link);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS,$post);
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
curl_setopt($curl, CURLOPT_MAXREDIRS, 10);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36");
curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
$data = curl_exec($curl);
if($data === false)
{
echo "Error Number:".curl_errno($ch)."<br>";
echo "Error String:".curl_error($ch);
}
curl_close($curl);
echo $data;
?>