使用curl_setopt抓取百度,百度图片防盗有什么好的办法?
$url = "http://www.baidu.com/s?wd=csdn";<br />$header = array (<br /> 'User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36'<br />);<br />$ch = curl_init ();<br />$timeout = 10; <br />curl_setopt ( $ch, CURLOPT_URL, $url );<br />curl_setopt ( $ch, CURLOPT_HTTPHEADER, $header );<br />curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );<br />curl_setopt ( $ch, CURLOPT_CONNECTTIMEOUT,$timeout);<br /><br />$content = curl_exec ( $ch );<br />if ($content == FALSE) {<br /> echo "error:" . curl_error ( $ch );<br />}<br /><br />curl_close ( $ch );<br />echo $content;