cURL错误1:不支持的协议:https [英] cURL Error 1: Unsupported protocol: https
本文介绍了cURL错误1:不支持的协议:https的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
全部
我正在尝试通过PHP的cURL包装器方法HTTPS POST SOAP请求,但始终出现以下cURL错误:错误1:不支持的协议:https,为什么会这样?目标网址很好,我可以通过命令行访问它.
I am trying to HTTPS POST a SOAP request via PHP's cURL wrapper methods but keep getting the following cURL error: Error 1: Unsupported protocol: https, Any ideas why this is happening? The target URL is good and I'm able to reach it via commandline.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$this->apiURL);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-type: text/xml;charset=UTF-8',
'Content-length: '.strlen($SOAPRequest),
'SOAPAction: ""'
) );
curl_setopt($ch, CURLOPT_POSTFIELDS, $SOAPRequest);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
$result = curl_exec($ch);
推荐答案
首先检查 phpinfo();
如果在PHP中启用了Curl(如phpinfo()的结果所示),则
If Curl is enabled in PHP as shown in the results of phpinfo() then
- 问题可能是MySQL字段中包含URL的多余空间.错误不是不是"HTTPS"协议不支持,而是不支持"HTTPS"(带有前导空格).
- The problem could be an extraneous space in the MySQL field containing the URL. The error isn't that the "HTTPS" protocol is unsupported, it is that " HTTPS" (with leading space) is unsupported.
这篇关于cURL错误1:不支持的协议:https的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文