gpt4 book ai didi

PHP cURL 表示不支持 https

转载 作者:太空宇宙 更新时间:2023-11-03 14:12:41 24 4
gpt4 key购买 nike

我正在向页面发出多个 cURL 请求。在这个 POST 请求之后,我的 cURL 输出中出现了这个错误

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

cURL 甚至不发出请求。我不知道如何解决这个错误。

奇怪的是我的 CLI 和 FPM 都启用了 SSL。在这里看到http://cl.ly/image/1L062C2h2M2W

我尝试向 http://而不是 https://发出请求。那并没有改变任何事情。我什至尝试确保我的服务器有 SSL,但这并没有改变它。

我的 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;

最后一次调用的完整调试是

______________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

“即将尝试”,是我自己的调试。当我尝试此请求时,这两个 ** 是 cURL 的唯一输出。

最佳答案

“https”前面有一个空格。错误是说不支持“https”。

关于PHP cURL 表示不支持 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27164422/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com