简体   繁体   English

PHP cURL说不支持https

[英]PHP cURL says https not supported

I'm making several cURL requests to a page. 我正在向页面发出几个cURL请求。 After this one POST request, I get this error in my cURL output 在执行此POST请求后,我的cURL输出中出现此错误

* Protocol  https not supported or disabled in libcurl
* Closing connection -1

cURL doesn't even make the request. cURL甚至没有发出请求。 I can't figure out how to solve this error. 我不知道如何解决此错误。

The weird thing is that SSL is enabled for both my CLI and FPM. 奇怪的是我的CLI和FPM都启用了SSL。 Seen here http://cl.ly/image/1L062C2h2M2W 在这里看到http://cl.ly/image/1L062C2h2M2W

I tried making the request to an http:// instead of https://. 我尝试将请求发送到http://而不是https://。 That didn't change anything. 那什么都没改变。 I even tried making sure my server had an SSL, and that didn't change it. 我什至尝试确保我的服务器具有SSL,并且这没有更改。

My cURL calls look like this 我的cURL调用看起来像这样

$fp2 = fopen('cookies/debug.txt', 'a');
fwrite($fp2, "\n $action");
fwrite($fp2, "\n $url");
fwrite($fp2, "\n ".sizeof($data));
fwrite($fp2, "\n ".json_encode($data));
fwrite($fp2, "\n_________________________________________\n");

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if($action == "POST") curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_POSTREDIR, 3);

$fp = fopen('cookies/curl.txt', 'a');
curl_setopt($ch, CURLOPT_STDERR, $fp);

curl_setopt($ch, CURLOPT_COOKIEJAR, $this->strCookie);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $this->strCookie);

    if($header) {
        curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
    }

// Set the request as a POST FIELD for curl.
if($action == "POST") {

    if(in_array("Content-Type:application/x-www-form-urlencoded", $header)) {
        $data = http_build_query($data);
    }

    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}

// Get response from the server.
$res = curl_exec($ch);
fwrite($fp, "\n_________________________________________\n");
fwrite($fp, "\n$action $url\n");

return $res;

and the full debug of the last call is 最后一次调用的完整调试是

______________about to try___________________________
POST  https://sellercentral.amazon.com/gp/communication-manager/view-message.html/ref=ag_xx__cmread?ie=UTF8&addnFilter0=rs&arrivalDate=1417064517&clcmResponseTimeSuboptions=uwd&curPage=1&dateExactEnd=&dateExactStart=&dateFilter=7d&isInbox=1&itemsPerPage=20&marketplaceId=ATVPDKIKX0DER&messageId=A3OSG68VXPA9BV&msgIndex=1&otherPartyId=&pageNum=1&replyToEmail=0&searchBoxText=&showFilters=0&sortBy=ArrivalDate&sortOrder=Descending&timestamp=1417070427&totalMsg=1&view=reader

* Protocol  https not supported or disabled in libcurl
* Closing connection -1

The "about to try", is my own debugging. “即将尝试”,是我自己的调试。 The two ** are the only output from cURL when I try this request. 当我尝试此请求时,两个**是cURL的唯一输出。

There was a space in front of the "https". “ https”前面有一个空格。 The error was saying " https" is not supported. 错误消息是不支持“ https”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM