Home > Backend Development > PHP Tutorial > php linux curl_exec() 微信,该如何解决

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

WBOY
Release: 2016-06-13 12:25:46
Original
1335 people have browsed it

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开了吗

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template