$ch2 = curl_init();
$user_agent = "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)";//这里模拟的是百度蜘蛛
curl_setopt($ch2, CURLOPT_URL, $url);
curl_setopt($ch2, CURLOPT_HEADER, false);
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch2, CURLOPT_REFERER, 'www.baidu.com');//1这里写一个来源地址,可以写要抓的页面的首页
curl_setopt($ch2, CURLOPT_USERAGENT, $user_agent);
$temp = curl_exec($ch2);
php 模拟百度蜘蛛
最新推荐文章于 2021-04-15 04:16:18 发布