时间:2021-07-01 10:21:17 帮助过:10人阅读
302 跳转了吧,贴出代码看看。
$url='http://www.baidu.com/link?url=0vb3_E6Y0Y3wZnKiqd0vhen9tAWVEpKiSqZlnyFDHx-hiORoCPFQUsj3f3hhqZldG6yzMuxJqswRj7scsSwgBf2bMqLLDpW';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
echo $data=curl_exec($ch);
curl_close($ch)
这个网址是我在百度采来的
总结,别打百度主意,空档没有想象那么多
$url='http://www.baidu.com/link?url=0vb3_E6Y0Y3wZnKiqd0vhen9tAWVEpKiSqZlnyFDHx-hiORoCPFQUsj3f3hhqZldG6yzMuxJqswRj7scsSwgBf2bMqLLDpW';$ch = curl_init();curl_setopt($ch, CURLOPT_URL,$url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)');curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); $html = curl_exec($ch);curl_close($ch);preg_match_all('/^Location: (?P.*?)$/m', $html, $matches);echo trim($matches['location'][0]);//http://www.qzwb.com/jk/content/2013-05/29/content_4458231.htm
用file_get_contents显示not found
用curl显示302 found
可是直接是能打开的
怎么解决呢
结帖率:0%, 20分也要记得结哦。
用file_get_contents显示not found
用curl显示302 found
可是直接是能打开的
怎么解决呢
结帖率:0%, 20分也要记得结哦。
不是这样的啊,我是想采http://www.qzwb.com/jk/content/2013-05/29/content_4458231.htm这里面的内容,打不开