function google($url){ //google收录抓取开始
header("Content-Type: text/html;charset=utf-8");
$url="http://www.google.com.hk/search?hl=zh-CN&q=".$url;
$cookie_file=dirname(__FILE__)."/temp/google.txt";
$ch= curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_COOKIEJAR,$cookie_file);
$contents= curl_exec($ch);
curl_close($ch);
header("Content-Type: text/html;charset=gb2312");
$contents = iconv("UTF-8", "gb2312//IGNORE", $contents);
return $contents;
}echo google("测试一下");
本地测试没问题的,可是传到服务器上一看  才知道设置了open_basedir CURLOPT_FOLLOWLOCATION就不支持了
求高手帮忙想想办法  看看还有没有其他办法抓取中文google的结果页