Provides various official and user-released code examples. For code reference, you are welcome to exchange and learn the php proxy collection code.
function curl_content ($url){
$user_agent = "Mozilla/4.0";
$proxy = "http://".get_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, "e:\www\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 $proxy.$result;
}
function get_proxy(){
$proxys = <<
107.151.136.202:80
1.34.223.206:80
1.34.223.229:80
189.8.82.82:80
str;
$proxys = explode("\r\n", $proxys);
$key = rand(1,count($proxys))-1;
return $proxys[$key];
}The proxy ip address is used on the Internet ..
Use a proxy ip address to collect website content...
Official navigation http://www.phpstd.com/wxjun
Thinkhp3.2.3 is automatically collected and updated, along with a total of 300 lines of code at the front-end.
AD: truly free, domain name + VM + enterprise mailbox = 0 RMB