Hi,
I would like to collect tweets lively using PHP and I want to store it in MongoDB datastore.
I have MongoDB connectivity to PHP and I created Webpage to simply display the tweets. I already worked in twitter4j package now I am using codebird for PHP. While I am working in JAVA, I don’t have any difficulty in storing tweets to db and also in JSON format.
But in PHP I don’t get correct format, here is my code for streaming api,
<?php
require_once 'src/codebird.php';
\Codebird\Codebird::setConsumerKey('***', '***');
$cb = \Codebird\Codebird::getInstance();
$cb->setToken("***", "***");
function some_callback($message)
{
var_dump('inside callback');
if ($message !== null) {
print_r($message);
flush();
}
//1 minute window
if(time()-$GLOBALS['time_start']>=60){
return true;
}
return false;
}
$cb->setStreamingCallback('some_callback');
$reply = $cb->statuses_filter('track=Windows');
If I execute this code, it will not return tweets in Json format. I want my tweets in json format to store in mongodb.
And what this ‘track=Windows’ means?
Please, Help me.
Prabha.