php libcurl 中不支持或禁用协议 https

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9595820/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 07:13:14  来源:igfitidea点击:

Protocol https not supported or disabled in libcurl

phpcurllibcurloscommerce

提问by AnNaMaLaI

I am using Authorize.net in my application(its in OSCOMMERCE) , When the user making payment its returning empty response. I debugged and find that it returning this error:

我在我的应用程序中使用 Authorize.net(在 OSCOMMERCE 中),当用户付款时返回空响应。我调试并发现它返回此错误:

Protocol https not supported or disabled in libcurl

libcurl 中不支持或禁用协议 https

I am sending a prober url starts with https there is no space in that https://secure.authorize.net/gateway/transact.dll

我送一个探测器URL开始以https没有空间在 https://secure.authorize.net/gateway/transact.dll

My application in shared hosting server. My doubt is this is server side problem or Programming problem ?

我在共享托管服务器中的应用程序。我怀疑这是服务器端问题还是编程问题?

采纳答案by drew010

Create a script called info.php and in it put <?php phpinfo(); ?>. Save it somewhere on your site so you can access it from a browser.

创建一个名为 info.php 的脚本并将<?php phpinfo(); ?>. 将其保存在您网站上的某个位置,以便您可以从浏览器访问它。

Find the curlsection and check what Protocolsare supported. If httpsis not listed, then cURL was not built with SSL support and you cannot use https.

找到curl部分并检查支持哪些协议。如果https未列出,则 cURL 未使用 SSL 支持构建,您不能使用 https。

You can also look in the very first section for Registered PHP Streamsand see if httpsis listed. If so, then you can fallback to use PHP's socket functions or functions such as file_get_contents()or fopenwith a context.

您还可以在第一部分中查看Registered PHP Streams并查看是否https已列出。如果是这样,那么您可以回退以使用 PHP 的套接字函数或函数,例如file_get_contents()fopen带有context

Since you mention you are on a shared host, request that your host recompile PHP so that both PHP and curl are built with OpenSSL support so you can use encryption, otherwise you will need to find another solution.

既然您提到您在共享主机上,请要求您的主机重新编译 PHP,以便 PHP 和 curl 都使用 OpenSSL 支持构建,以便您可以使用加密,否则您将需要找到其他解决方案。

回答by parastoo amini

I had this problem and it was because of space in url:

我遇到了这个问题,这是因为 url 中的空间:

' https://www.google.com/recaptcha/api/siteverify'

as you see there is a space before https

如您所见,https 前有一个空格

回答by Carlton

For those that have https support but still get an error similar to below

对于那些有 https 支持但仍然收到类似于下面的错误的人

[curl] 1: Protocol %20https not supported or disabled in libcurl [url] %20https://www.example.com/%20

Ensure that the URL is valid

确保 URL 有效

  • Try on a basic URL such as https://www.example.com
  • Check your URLs and make sure no spaces at start/end of URL (as shown above as %20)
  • Check for characters in your URL likely to break the curl request
  • 尝试使用基本 URL,例如https://www.example.com
  • 检查您的网址并确保网址开头/结尾处没有空格(如上所示 %20)
  • 检查 URL 中可能会破坏 curl 请求的字符