CURL 就可以啊!你的先自己开个http代理 。或者百度找一些http代理
然后在curl里面设置http代理就可以了。
function curl_string ($url,$user_agent,$proxy){$ch = curl_init()
curl_setopt ($ch, CURLOPT_PROXY, $proxy)
curl_setopt ($ch, CURLOPT_URL, $url)
curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent)
curl_setopt ($ch, CURLOPT_COOKIEJAR, "c:\cookie.txt")//可删除
curl_setopt ($ch, CURLOPT_HEADER, 1)
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1)
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1)
curl_setopt ($ch, CURLOPT_TIMEOUT, 120)
$result = curl_exec ($ch)
curl_close($ch)
return $result
}
$content = "http://www.google.com"$user_agent = "Mozilla/4.0"$proxy = "http://192.11.222.124:8000"
function curl_string ($url,$timeout = 3,$proxy=1){$ua = array('Mozilla','Opera','Microsoft Internet Explorer','ia_archiver')
$op = array('Windows','Windows XP','Linux','Windows NT','Windows 2000','OSX')
$agent = $ua[rand(0,3)].'/'.rand(1,8).'.'.rand(0,9).' ('.$op[rand(0,5)].' '.rand(1,7).'.'.rand(0,9).'en-US)'
Tor 地址与端口
$tor = 'http://www.aimilife.com' //这里是你的代理服务器
连接超时设置
$timeout = 3
$ack = curl_init()
if($proxy)
{
curl_setopt($ack, CURLOPT_PROXY, $tor)
}
curl_setopt($ack, CURLOPT_URL, $url)
curl_setopt($ack, CURLOPT_HEADER, 0)
curl_setopt($ack, CURLOPT_USERAGENT, $agent)
curl_setopt($ack, CURLOPT_RETURNTRANSFER, 1)
curl_setopt($ack, CURLOPT_FOLLOWLOCATION, 1)
curl_setopt($ack, CURLOPT_TIMEOUT, $timeout)
$result = curl_exec($ack)
curl_close($ack)
return $result
}
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)