以后可以直接拿来使用
function my_get_http_result($url, $cookie=array()){
if (empty($url)){
return false;
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$url");
curl_setopt($ch, CURLOPT_TIMEOUT, 8);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
if (!empty($cookie)){
curl_setopt ($ch, CURLOPT_COOKIE, $cookie );
}
$result = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
if( $info['http_code'] != 200 )
return '';
return $result;
}