[英]Laravel Guzzle - cURL error 3: (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
[英]cURL error 60: See http://curl.haxx.se/libcurl/c/libcurl-errors.html
您好,我正在嘗試使用 google+ rest API 獲取配置文件數據,但我收到此錯誤:
致命錯誤:未捕獲異常“GuzzleHttp\Ring\Exception\RingException”,消息為“cURL 錯誤 60:請參閱 C:\wamp\www\ 中的http://curl.haxx.se/libcurl/c/libcurl-errors.html ” plus3\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php 第 51 行
這是錯誤屏幕截圖。
目前我正在本地主機上工作。 我已經嘗試了一切,包括安裝 composer、curl 等。 不確定我做錯了什么。 為什么我不能從配置文件中獲取數據。
這是代碼:
<?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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.