Heim  >  Artikel  >  Backend-Entwicklung  >  php linux curl_exec() 微信,该如何解决

php linux curl_exec() 微信,该如何解决

WBOY
WBOYOriginal
2016-06-13 12:25:461260Durchsuche

php linux curl_exec() 微信
function api_notice_increment($url, $data){
$ch = curl_init();
$header = "Accept-Charset: utf-8";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                echo "start";
$tmpInfo = curl_exec($ch);
                echo $tmpInfo;
                echo "end";
$errorno=curl_errno($ch);
if ($errorno) {
return array('rt'=>false,'errorno'=>$errorno);
}else{
$js=json_decode($tmpInfo,1);
if ($js['errcode']=='0'){
return array('rt'=>true,'errorno'=>0);
}else {
$errmsg=GetErrorMsg::wx_error_msg($js['errcode']);
$this->error($js['errcode'].':'.$errmsg.'!!');
}
}
}

在window上没有任何问题,但是在linux系统上$tmpInfo返回为空,curl的版本之前是4.4 现在换成了7.44 还是不行,请教一下,这个是什么问题,困扰很久了

------解决思路----------------------
你php的 openssl开了吗

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn