您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php出现curl 35号错误怎么办

2024/2/21 16:48:29发布24次查看
php出现curl 35号错误怎么办?
php开发-用curl向https发请求时的35号错误
放了个假发现以前写的程序的模拟登陆不管用了,中间输出,发现curl向https发请求时没有返回数据,输出错误信息,得到:
curl_errno($ch) -----> 35curl_error($ch) -----> error:14077458:ssl routines:ssl23_get_server_hello:reason(1112)
查了很多资料,终于发现要强行指定ssl的版本,即加上下面的话就可以了:
curl_setopt($ch, curlopt_sslversion, 3);
整个函数也贴下来供参考:
function sendposthttps($url, $postdata, $header=0, $referer=""){ $ch = curl_init () ; curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_header, $header); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_url, $url) ; curl_setopt($ch, curlopt_postfields, $postdata); curl_setopt($ch, curlopt_referer, $referer); curl_setopt($curl, curlopt_useragent, $_server['http_user_agent']); curl_setopt($ch, curlopt_ssl_verifypeer, 0); curl_setopt($ch, curlopt_ssl_verifyhost, 1); curl_setopt($ch, curlopt_sslversion, 3); $result = curl_exec($ch); curl_close($ch); return $result;}
更多相关知识,请访问!
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product