Streaming Api:: Browser does not display on time


#1

I am quite new in using Twitter Apis. I used the code below for getting the real-time tweets with determined keyword. It wroks fine when i execute it using command line.But when i execute it in browser it does not display the tweets on time it first takes lots of time then print lots of tweets in one shot. It repeated it again and again. How can it fixed? Any kind of help will be highly appreciated.

<?php /***************libraries*********************/ require_once('../lib/Phirehose.php'); require_once('../lib/OauthPhirehose.php'); /*********Escape from Execution Time***********/ set_time_limit(0); class FilterTrackConsumer extends OauthPhirehose { public function enqueueStatus($status) { $data = json_decode($status, true); if (is_array($data) && isset($data['user']['screen_name'])) { print $data['text']; } } } /*************************API KEYS*******************************/ define('TWITTER_CONSUMER_KEY', 'api_key'); define('TWITTER_CONSUMER_SECRET','api_secret'); define('OAUTH_TOKEN','token'); define('OAUTH_SECRET','token secret');?>

// Start streaming
$sc = new FilterTrackConsumer(OAUTH_TOKEN, OAUTH_SECRET, Phirehose::METHOD_FILTER);
$sc->setTrack(array(’#keyword’));
$sc->consume();
?>