抓取防盗网站链接或者防盗的图片时怎么操作呢?
php file_get_content获取资源时添加header请求头即可:$context_options = array(
'http' =>
array(
'method' => "GET",
'header' => "User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36\r\nReferer:http://www.zhuyanjun.cn/\r\n",
));
$context = stream_context_create($context_options);
$html = file_get_contents('https://www.demo.com/',FALSE,$context);