我正在按照
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上的localhost机器上尝试了上面的代码,但是出现了这个错误
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);