+ -
当前位置:首页 → 问答吧 → file_get_contents 为什么取不到 google 的数据

file_get_contents 为什么取不到 google 的数据

时间:2010-10-12

来源:互联网


为什么 file_get_contents 取不到 http://www.google.com.hk/search?hl=zh-CN&source=hp&q=site%3Awww.php100.com 的数据。

$url = 'http://www.google.com.hk/search?hl=zh-CN&source=hp&q=site%3Awww.php100.com';

echo file_get_contents($url);


百度的 http://www.baidu.com/s?wd=site:www.php100.com就可以

有哪位帮忙试试看!
[ 此帖被mare在2010-10-12 23:57重新编辑 ]

作者: mare   发布时间: 2010-10-12

改用CURL。鬼知道Google有没有要求UserAgent

作者: cain   发布时间: 2010-10-13

编码问题,这咱查询收录的小偷,百度好像是 gbk ,google是utf-8

作者: zuiaisansi   发布时间: 2010-10-13