php - 连接到 getstream php 时出错

标签 php curl getstream-io

我正在按照 https://getstream.io/get_started/?language=php 中的示例进行操作了解 getstream io 的工作原理。我遇到了一个让我感到困惑的错误。

 require_once './vendor/autoload.php';
 $client = new GetStream\Stream\Client('YOUR_API_KEY',     'API_KEY_SECRET');
$chris = $client->feed('user', 'chris');
 // I replaced Your api key and api key secret with the one         in my dashboard
// Add an activity; message is a custom field - tip: add unlimited         custom fields!
$data = array(
"actor" => "chris",
"verb" => "add",
"object" => "picture:10",
"foreign_id" => "picture:10",
"message" => "Beautiful bird. Absolutely beautiful. Phenomenal bird."
);

$chris->addActivity($data);


// jack's 'timeline' feed follows chris' 'user' feed:
$jack = $client->feed('timeline', 'jack');
$jack->followFeed('user', 'chris');


// Read the 'timeline' feed for jack, chris' post will now show up: 
$activities = $jack->getActivities(10);
var_dump($activities);

在我的 composer.json 文件中我这样做了

       "require": {
        "get-stream/stream": "2.2.8"
        }

我在 Windows 上的本地主机上尝试了上面的代码,但出现了这个错误

Fatal error: Uncaught exception 'GuzzleHttp\ExceptionConnectException'     with message 'cURL error 28: Operation timed out after 0 milliseconds with 0 out of 0 bytes received (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)' in C:\xampp\htdocs\CorpersMate\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 186
 GuzzleHttp\Exception\ConnectException: cURL error 28: Operation timed out after 0 milliseconds with 0 out of 0 bytes received (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in C:\xampp\htdocs\CorpersMate\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 186

有什么想法吗?

最佳答案

您应该提供指南 - 我们必须先注册才能获得它,这是不可能发生的。

将第二行改为

$client = new GetStream\Stream\Client(KEY, SECRET);

关于php - 连接到 getstream php 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39671102/

相关文章:

getstream-io - getstream.io : Adding activities to a user's feed without a following relation

getstream-io - 如何在getStream上获取 "How many unread notifications does user have"?

php - 代表论坛网站泛化案例的最佳方法是什么

javascript - 如何使用 getJSON 将 javascript 变量传递给 php

rest - 解析 REST API 将 ACL 设置为对象

PHP curl : enforce low TLS version

getstream-io - 是否可以过滤提要

php - php 的表单问题。动态选择的选项和复选框

php - 使用 php 和 html 选择框过滤 SQL 查询

java - Couchdb 通过 Httpclient 上传图片