我不断地通过 guzzle 库以 json 格式从 gnip 获取流式 Twitter 数据。
下面是我的代码
require_once('vendor/autoload.php');
$url =https://stream.gnip.com:443/accounts/{account_name}/publishers/twitter/streams/track/dev.json";
$username = '*****';
$password = '*****';
$headers = array('Accept-Encoding' => 'gzip');
$client = new GuzzleHttp\Client();
$client->setDefaultOption('headers/Accept-Encoding', 'gzip');
$data = $client->get($url, ['auth' => [$username, $password]]))
{
$tdata = $data->getBody();
//here i am getting json data continuously,that I have to insert in my db.
//I have written my code to insert in db and it is inserting in db but after some time it will not insert in db.
}
所以请建议我,如果有其他最好的方法或一些 php 库可用。