Hey, I'm trying to use the streaming API to fetch tweets from a certain hash tag as they come in.
i understand that i have to use the 'statuses/filter' request of the public streams from the streaming API but i'm having trouble translating that in code bird.
With the Streaming API example provided i recognized that the user streams from the streaming API is being used and that works fine for me(I'm getting a stream of my twitter account).
However changing $reply = $cb->user(); to $reply = $cb->public(); causes the error
" Uncaught Exception: Can't find HTTP method to use for 'public' "
i also tried just using $reply = $cb->public_statuses_filter('track=#jiggajagga'); which returns the same error and $reply = $cb->statuses_filter('track=#jiggajagga'); which returns nothing, no error and no tweets just nothing. Any help would be greatly appreciated
Below is my full code
`require_once('codebird.php');
\Codebird\Codebird::setConsumerKey('Co*******', 'PQ*******');
$cb = \Codebird\Codebird::getInstance();
$cb->setToken('3*******', '********');
// First, create a callback function:
function myTweets($message){
// gets called for every new streamed message
// gets called with $message = NULL once per second
if($message !== null){
print_r($message);
flush();
}
// return false to continue streaming
// return true to close the stream
// close streaming after 1 minute for this simple sample
// don't rely on globals in your code!
if (time() - $GLOBALS['time_start'] >= 20) {
return true;
}
return false;
}
// set the streaming callback in Codebird
//$cb->setStreamingCallback('some_callback');
$cb->setStreamingCallback('myTweets');
// any callable is accepted:
// $cb->setStreamingCallback(['MyClass', 'some_callback']);
// for canceling, see callback function body
// not considered good practice in real world!
$GLOBALS['time_start'] = time();
// Second, start consuming the stream:
$reply = $cb->user();
// See the *Mapping API methods to Codebird function calls* section for method names.
//$reply = $cb->statuses_filter('track=Windows');`
Okay i solved the issue
it works with just using the $reply = $c->statuses_filter('track=Windows'); apparently windows isn't something person tweet about often
Hey, I'm trying to use the streaming API to fetch tweets from a certain hash tag as they come in. i understand that i have to use the 'statuses/filter' request of the public streams from the streaming API but i'm having trouble translating that in code bird.
With the Streaming API example provided i recognized that the user streams from the streaming API is being used and that works fine for me(I'm getting a stream of my twitter account). However changing
$reply = $cb->user();
to$reply = $cb->public();
causes the error" Uncaught Exception: Can't find HTTP method to use for 'public' "
i also tried just using
$reply = $cb->public_statuses_filter('track=#jiggajagga');
which returns the same error and$reply = $cb->statuses_filter('track=#jiggajagga');
which returns nothing, no error and no tweets just nothing. Any help would be greatly appreciated Below is my full code`require_once('codebird.php');