PHP 与卷曲和视窗Vista

发布于 2024-11-01 15:42:36 字数 868 浏览 3 评论 0原文

在 Windows Vista 上使用 cURL 时遇到问题。该库在那里并用 phpinfo() 显示,但curl_exec() 没有返回网页内容 - 当在 Linux 服务器上上传和测试时,相同的代码没有问题,按预期返回数据。

有人有这方面的经验/想法吗?我正在使用 xampp 和 php 5.2.6。

更新:

Array( [url] => https://graph.facebook.com/me
    [content_type] => [http_code] => 0
    [header_size] => 0
    [request_size] => 0
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0
    [namelookup_time] => 0
    [connect_time] => 0.203
    [pretransfer_time] => 0
    [size_upload] => 0
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 0
    [download_content_length] => -1
    [upload_content_length] => -1
    [starttransfer_time] => 0
    [redirect_time] => 0 )

是我从 print_r(curl_getinfo($ch)); 得到的响应

Having issues using cURL on windows vista. The library is there and showing with phpinfo(), but curl_exec() is not returning the web page content - when uploaded and tested on a linux server there's no problems with the same code, returns the data as expected.

Does anyone have any experience with this/ideas? I'm using xampp and php 5.2.6.

UPDATE:

Array( [url] => https://graph.facebook.com/me
    [content_type] => [http_code] => 0
    [header_size] => 0
    [request_size] => 0
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0
    [namelookup_time] => 0
    [connect_time] => 0.203
    [pretransfer_time] => 0
    [size_upload] => 0
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 0
    [download_content_length] => -1
    [upload_content_length] => -1
    [starttransfer_time] => 0
    [redirect_time] => 0 )

Is the response I get from print_r(curl_getinfo($ch));

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

韶华倾负 2024-11-08 15:42:36

我注意到这是一个 https 地址。

尝试这样做:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 

将其设置为 false 允许 Curl 接受任何 CA

您可以在此处查看文档:
http://php.net/manual/en/function.curl-setopt.php

CURLOPT_SSL_VERIFYPEER
FALSE 阻止 cURL 验证对等方的证书。可以使用 CURLOPT_CAINFO 选项指定要验证的备用证书,也可以使用 CURLOPT_CAPATH 选项指定证书目录。如果 CURLOPT_SSL_VERIFYPEER 被禁用(默认为 2),CURLOPT_SSL_VERIFYHOST 也可能需要为 TRUE 或 FALSE。

I noticed that's a https address.

Try doing this:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 

Setting that to false allows Curl to accept any CA.

You can check the documentation here:
http://php.net/manual/en/function.curl-setopt.php

CURLOPT_SSL_VERIFYPEER
FALSE to stop cURL from verifying the peer's certificate. Alternate certificates to verify against can be specified with the CURLOPT_CAINFO option or a certificate directory can be specified with the CURLOPT_CAPATH option. CURLOPT_SSL_VERIFYHOST may also need to be TRUE or FALSE if CURLOPT_SSL_VERIFYPEER is disabled (it defaults to 2).

旧城烟雨 2024-11-08 15:42:36

我认为你应该改变:[url] => https://graph.facebook.com/me

[url] => "https://graph.facebook.com/me"

我假设您使用的是逗号分隔 php 数组中的键值对。

I think you should change: [url] => https://graph.facebook.com/me to

[url] => "https://graph.facebook.com/me"

I assume that you are using commas to separate the key-value pairs in php array.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文