嗨,我正在尝试使用 google+ rest API 获取配置文件数据,但我收到此错误:
致命错误:未捕获的异常"GuzzleHttp''Ring''Exception''RingException",消息"cURL 错误 60:请参阅第 http://curl.haxx.se/libcurl/c/libcurl-errors.html 行 C:''wamp''www''plus3''vendor''guzzlehttp''guzzle''src''Exception''RequestException.php在第 51 行
这是错误屏幕截图。
目前,我正在本地主机上工作。我已经尝试了所有包括安装作曲家,卷曲...等。不知道我做错了什么。为什么我不能从配置文件中获取数据。
这是代码:
<?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>
也许有点晚了,但对于将来在这些页面上漫步的人来说:
检查您的 php.ini 文件中的选项"curl.cainfo"。指定证书的绝对路径(可在以下位置下载:http://curl.haxx.se/ca/cacert.pem(。通过删除行首的分号来激活该选项。重新启动Apache服务器,你应该没问题。
如果你的操作系统有 centos 或 Fedora,必须允许Httpd_can_network_connect连接。默认情况下,所有访问HTTPD(nginx-Apache -...(都是禁用的。
setsebool httpd_can_network_connect 1