function Curlrequest ($url, $data =array (), $method = ' GET ') {
$method = Strtoupper ($method);
$ch = Curl_init ();
curl_setopt ($ch, Curlopt_failonerror, 1);
curl_setopt ($ch, curlopt_returntransfer,1);
curl_setopt ($ch, Curlopt_timeout, 5);
$param = Http_build_query ($data);
//curl_setopt ($ch, Curlopt_proxy, ' 10.13.130.64:80 ');
if ($method = = = ' POST ') {
//echo $url;
curl_setopt ($ch, Curlopt_url, $url);
curl_setopt ($ch, Curlop T_post, 1);
$param =str_replace (' & ', ' & ', $param);
curl_setopt ($ch, Curlopt_postfields, $param);
} else {
//echo $url;
if ($param) {
$url = (Stripos ($url, "?") = = = = False)? ($url. "?" . $param): ($url. ' & '. $param);
$url =str_replace (' & ', ' & ', $url);
}
//echo $url;
curl_setopt ($ch, Curlopt_url, $url);
curl_setopt ($ch, curlopt_post, 0);
}
//$header []= ' ACCEPT-LANGUAGE:ZH-CN ';
//$header []= ' user-agent:mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;. NET CLR 2.0.50727) ';
//$header []= ' connection:keep-alive ';
//$header []= ' Cache-control:no-cache ';
//curl_setopt ($ch, Curlopt_httpheader, $header);
$result = curl_exec ($ch);
Curl_close ($ch);
return $result;
}
Curl Request Method function