/
* 提交请求
* @param $host array 需要配置的域名 array("Host: act.qzone.qq.com
");
* @param $data string 需要提交的数据 array("user:xiaoming",)
* @param $url string 要提交的url ' http://192.168.1.12/xxx/xxx/api/
';
*/
function curl_post($host,$data,$url)
{
* 提交请求
* @param $host array 需要配置的域名 array("Host: act.qzone.qq.com
");
* @param $data string 需要提交的数据 array("user:xiaoming",)
* @param $url string 要提交的url ' http://192.168.1.12/xxx/xxx/api/
';
*/
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_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);
$result = curl_exec ($ch);
curl_close($ch);
if ($result == NULL) {
return 0;
}
TMDebugUtils::debugLog($result);
return $result;
}
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);
$result = curl_exec ($ch);
curl_close($ch);
if ($result == NULL) {
return 0;
}
TMDebugUtils::debugLog($result);
return $result;
}