卷曲问题,无法下载完整网页

发布于 2024-09-24 09:35:33 字数 1056 浏览 0 评论 0原文

使用此代码,我尝试下载此网页: http://www.kayak.com/s/...

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'http://www.kayak.com/s/search/air?ai=kayaksample&do=y&ft=ow&ns=n&cb=e&pa=1&l1=ZAG&t1=a&df=dmy&d1=4/10/2010&depart_flex=exact&r1=y&l2=LON&t2=a&d2=11/10/2010&return_flex&r2=y');

 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($ch, CURLOPT_FAILONERROR, true);
 curl_setopt($ch, CURLOPT_REFERER,"http://wwww.google.com"); 

 $content = curl_exec ($ch);
 echo $content;

您可以在以下位置查看演示:http://www.pointout.org/test.php
正如您所看到的,带有价格的部分丢失了。
可能出什么问题了?

With this code I'm trying to download this web page: http://www.kayak.com/s/...

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'http://www.kayak.com/s/search/air?ai=kayaksample&do=y&ft=ow&ns=n&cb=e&pa=1&l1=ZAG&t1=a&df=dmy&d1=4/10/2010&depart_flex=exact&r1=y&l2=LON&t2=a&d2=11/10/2010&return_flex&r2=y');

 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($ch, CURLOPT_FAILONERROR, true);
 curl_setopt($ch, CURLOPT_REFERER,"http://wwww.google.com"); 

 $content = curl_exec ($ch);
 echo $content;

You can see the demo at: http://www.pointout.org/test.php
As you can see the part with prices is missing.
What could be wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心欲静而疯不止 2024-10-01 09:35:33

这不会像你想象的那样工作。原因是价格不在您收到的初始 HTML 响应中。相反,发生了一些 Javascript 魔法,即在加载页面时使用 AJAX 来加载价格。

This is not going to work the way you think it will. The reason is the prices are not in the initial HTML response that you get. Rather, there is some Javascript magic occurring which is using AJAX to load the prices when the page is loaded.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文