function getsourcecode($q){
return @file_get_contents($q);
}
//用curl获取网站源文件
function c_getpagecode($c_url,$p_i=0){
$user_agent = "mozilla/4.0";
$proxy[0] = "http://211.155.231.208:80"; //浙江省杭州市 电信idc机房
$proxy[1] = "http://210.51.10.197:8888"; //北京市 通泰大厦网通idc机房
$ch = curl_init();
curl_setopt ($ch, curlopt_proxy, $proxy[$p_i]);
curl_setopt ($ch, curlopt_url, $c_url);
curl_setopt ($ch, curlopt_useragent, $user_agent);
//curl_setopt ($ch, curlopt_cookiejar, "c:cookie.txt");
curl_setopt ($ch, curlopt_header, 0);
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;
}
|