php发送get请求并获取输出


php send get request and get output

我想向www.seatguru.com发出getrequest,例如,它看起来像这样:http://www.seatguru.com/findseatmap/findseatmap.php?airlinetext=American+Airlines&carrier=AA&flightno=3180&from=Philadelphia%2C+PA+-+Philadelphia+International+Airport+%28PHL%29&to=&date=07%2F03%2F2013&from_loc=PHL&to_loc=&search_type=

问题是,当我收到请求时,它只显示"正在加载…",这意味着我可以检查输出。我有什么办法绕过它吗?

这是我的卷发:

$qry_str = "?airlinetext=American+Airlines&carrier=AA&flightno=3180&from=Philadelphia%2C+PA+-+Philadelphia+International+Airport+%28PHL%29&to=&date=07%2F03%2F2013&from_loc=PHL&to_loc=&search_type=";
$ch = curl_init();
// Set query data here with the URL
curl_setopt($ch, CURLOPT_URL, 'http://www.seatguru.com/findseatmap/findseatmap.php' . $qry_str); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, '3');
$content = trim(curl_exec($ch));
curl_close($ch);

非常感谢。

之所以会发生这种情况,是因为结果实际上是通过ajax加载的。因此,当页面加载时,结果不在那里,你会看到加载标志。你可以通过查询页面用于获取结果的url来绕过这一点。理想情况下,您可以在文档检查器(Chrome/FF Firebug)中搜索XHR请求,并对其进行排序以查找相关请求,但嘿,我为您完成了这项工作。

http://www.seatguru.com/ajax/findseatmap.php?from=PHL&to=&flightno=3180&carrier=AA&date=07%2F03%2F2013

(注意findseatmap之前url中的ajax)

哦,刮之前一定要问他们。由于他们失去了生意,一般来说,勉强度日是不好的。