【问题标题】:cURL error 60: See http://curl.haxx.se/libcurl/c/libcurl-errors.htmlcURL 错误 60:参见 http://curl.haxx.se/libcurl/c/libcurl-errors.html
【发布时间】:2016-04-14 06:41:18
【问题描述】:

您好,我正在尝试使用 google+ rest API 获取个人资料数据,但我收到此错误:

致命错误:未捕获的异常 'GuzzleHttp\Ring\Exception\RingException' 带有消息 'cURL 错误 60:请参阅 C:\wamp\www\plus3\vendor\guzzlehttp\guzzle\src\Exception\RequestException 中的 http://curl.haxx.se/libcurl/c/libcurl-errors.html' .php 在第 51 行

Here 是错误截图。

目前我正在本地主机上工作。我已经尝试了一切,包括 安装作曲家,卷曲...等。 不知道我做错了什么。为什么我无法从个人资料中获取数据。

代码如下:

   <?php

include_once __DIR__ . '/../vendor/autoload.php';
include_once "templates/base.php";

  session_start();

$client = new Google_Client();


  $client = new Google_Client();
    $client->setApplicationName("Google+ PHP Starter Application");

    // credentials are intentionally not disclosed but they are correct. 
     $client->setClientId('XXXXXX');
     $client->setClientSecret('XXXXXXX');
     $client->setRedirectUri('http://localhost/....');
     $client->setDeveloperKey('XXXXX');

    $plus = new Google_Service_Plus($client);

//Everything works fine before this line...as soon as i write the line
//below to fetch results with name brett...it throws me an error.

    $results = $plus->people->search('brett');

    ?>
  <!doctype html>
    <html>
    <head><link rel='stylesheet' href='style.css' /></head>
    <body>
    <header><h1>Google+ Sample App</h1></header>
    </body>
    </html>

【问题讨论】:

  • 你看错了吗?
  • 我做了...我认为它与 curl 有关...我确实安装了它...无论如何我可以仔细检查一下吗?

标签: php api rest google-plus


【解决方案1】:

如果你的操作系统有 centos 或 Fedora,必须允许 Httpd_can_network_connect 连接。 默认情况下所有访问 httpd(nginx-apache-...) 都是禁用的。


setsebool httpd_can_network_connect 1

【讨论】:

    【解决方案2】:

    也许有点晚了,但对于以后在这些页面上闲逛的人来说:

    检查您的 php.ini 文件中的选项“curl.cainfo”。指定证书的绝对路径(您可以在以下位置下载:http://curl.haxx.se/ca/cacert.pem)。 通过删除行首的分号来激活该选项。重启 Apache 服务器,你应该没问题。

    【讨论】:

    • 嗨,你能告诉我如何将它安装在我的家园
    • 嗨 Tuhin,不幸的是我不熟悉 Homestead。话说回来;我的回答不涉及“安装”任何东西。只需激活默认禁用的选项。祝你好运!
    猜你喜欢
    • 2021-01-08
    • 2019-12-17
    • 1970-01-01
    • 2019-05-25
    • 2016-12-18
    • 1970-01-01
    • 2017-05-24
    • 2020-11-07
    • 2021-04-29
    相关资源
    最近更新 更多