网络请求:
/**
* 发起HTTPS请求
*/
function curl_post($url,$data=null,$header=null,$post=0)
{
//初始化curl
$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, $post);
if($post && !is_null($data))
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
if (!is_null($header))
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
$result = curl_exec ($ch);
//连接失败
curl_close($ch);
return $result;
}