/**
* 通过URL获取远程页面内容
* @param string $url URL地址
* @return string 返回页面文本内容,默认为null
*/
function GetHttpContent($url) {
if(class_exists(Network)){
$ajax = Network::Create();
if(!$ajax) return null;
$ajax->open(GET,$url);
$ajax->enableGzip();
$ajax->setTimeOuts(60,60,0,0);
$ajax->send();
return $ajax->responseText;
}
$r = null;
if (function_exists("curl_init") && function_exists(curl_exec)) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
if(ini_get("safe_mode")==false && ini_get("open_basedir")==false){
curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
}
if(extension_loaded(zlib)){
curl_setopt($ch, CURLOPT_ENCODING, gzip);
}
$r = curl_exec($ch);
curl_close($ch);
} elseif (ini_get("allow_url_fopen")) {
$r = file_get_contents((extension_loaded(zlib)?compress.zlib://:) . $url);
}
return $r;
}