php curl采集的提示403异常

WBOY
Release: 2016-06-13 12:53:05
Original
1503 people have browsed it

php curl采集的提示403错误
function get_music_detail_url($url){

if(empty($url)) return array();

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);       
curl_setopt($ch,CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_HEADER, 0); 
$somecontent = curl_exec($ch); 
curl_close($ch); 
return $somecontent;
}
$re = $client->get_music_detail_url("http://music.douban.com/subject/1756577/");
print_r($re);

提示以下错误

403 Forbidden
nginx

请问如何解决才能正常采集呢。遇到提示403的问题。该如何采集这个页面


------解决方案--------------------
经测试,没有发现你说的现象
不过页面数据中有 js 操控,得到的可能不是你需要的东西
------解决方案--------------------
同一段代码,有人403,有人正常,这种情况针对IP(范围)限制的可能性极高
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template