$host = Array ("Host:act.qzone.qq.com");//domain name not with http://
$data = Array (
' AA ' = ' xx ',
' BB ' = ' xx '
);
$url = ' http://127.0.0.1/xxx/xxx/api/';
Var_dump ($this->curl_post ($host, $data, $url));
function Curl_post ($host, $data, $url)
{
$ch = Curl_init ();
$res = curl_setopt ($ch, Curlopt_url, $url);
curl_setopt ($ch, Curlopt_ssl_verifyhost, FALSE);
curl_setopt ($ch, Curlopt_ssl_verifypeer, FALSE);
curl_setopt ($ch, Curlopt_header, 0);
curl_setopt ($ch, Curlopt_post, 1);
curl_setopt ($ch, Curlopt_postfields, $data);
curl_setopt ($ch, Curlopt_returntransfer, 1);
curl_setopt ($ch, Curlopt_httpheader, $host);
$handles = curl_exec ($ch);
Curl_close ($ch);
return $handles;
}
function PostData ($url, $post)
{
$ch = Curl_init ();
$timeout = 300;
curl_setopt ($ch, Curlopt_url, $url);
curl_setopt ($ch, Curlopt_post, true);
curl_setopt ($ch, Curlopt_postfields, $post);
curl_setopt ($ch, Curlopt_returntransfer, 1);
curl_setopt ($ch, Curlopt_connecttimeout, $timeout);
$handles = curl_exec ($ch);
Curl_close ($ch);
return $handles;
}
PHP CURL Header Sets host host header for access and post submission numbers