i developing payment php weixin. code implemented follow. curl_exec return false ,
$ch = curl_init(); curl_setopt($ch, curlopt_timeout, $second); if(wxpayconfig::curl_proxy_host != "0.0.0.0" && wxpayconfig::curl_proxy_port != 0){ curl_setopt($ch,curlopt_proxy, wxpayconfig::curl_proxy_host); curl_setopt($ch,curlopt_proxyport, wxpayconfig::curl_proxy_port); } curl_setopt($ch,curlopt_url, $url); curl_setopt($ch,curlopt_ssl_verifypeer,true); curl_setopt($ch,curlopt_ssl_verifyhost,2); curl_setopt($ch, curlopt_header, false); curl_setopt($ch, curlopt_returntransfer, true); if($usecert == true){ curl_setopt($ch,curlopt_sslcerttype,'pem'); curl_setopt($ch,curlopt_sslcert, wxpayconfig::sslcert_path); curl_setopt($ch,curlopt_sslkeytype,'pem'); curl_setopt($ch,curlopt_sslkey, wxpayconfig::sslkey_path); } curl_setopt($ch, curlopt_post, true); curl_setopt($ch, curlopt_postfields, $xml); $data = curl_exec($ch);
i catch error message of curl_exec , message following.
"ssl certificate problem, verify ca cert ok. details: error:14090086:ssl routines:ssl3_get_server_certificate:certificate verify failed"
this because of "curl_setopt($ch,curlopt_ssl_verifypeer,true);"
you should set "curl_setopt($ch,curlopt_ssl_verifypeer,false);".
Comments
Post a Comment