问题
All,
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);
回答1:
First check phpinfo();
If Curl is enabled in PHP as shown in the results of phpinfo() then
- 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.
回答2:
Your PHP was compiled without SSL support.
来源:https://stackoverflow.com/questions/4673154/curl-error-1-unsupported-protocol-https