Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('../lib/UserstreamPhirehose.php');
- $time_start = microtime(true);
- //その時歴史は動いた
- $twcount = 0;
- //メンタルリセット
- /**
- * Barebones example of using UserstreamPhirehose.
- */
- class MyUserConsumer extends UserstreamPhirehose
- {
- public function enqueueStatus($status)
- {
- /*
- * In this simple example, we will just display to STDOUT rather than enqueue.
- * NOTE: You should NOT be processing tweets at this point in a real application, instead they
- * should be being enqueued and processed asyncronously from the collection process.
- */
- global $time_start ,$twcount;
- //関数内に変数を引きずりこむ
- $time_end = microtime(true);
- //時間 今
- $times = $time_end - $time_start;
- //ビョースー計算
- $twcount++;
- //インクリ////
- $twsoku = ($twcount / $times) * 60;
- //(平均値)出すぞオラッ!!
- $twsoku = round($twsoku, 2);
- //まるくなぁれ
- echo "$twsoku Tweets/min(Total: $twcount Tweets)<BR>";
- //ドピュ
- flush();
- ob_flush();
- //(途)中(だけど)出(力)し(ちゃう)
- }
- }
- //This variable has been deletedXD
- //These are the application key and secret
- //You can create an application, and then get this info, from https://dev.twitter.com/apps
- //(They are under OAuth Settings, called "Consumer key" and "Consumer secret")
- define('TWITTER_CONSUMER_KEY', '');
- define('TWITTER_CONSUMER_SECRET', '');
- //These are the user's token and secret
- //You can get this from https://dev.twitter.com/apps, under the "Your access token"
- //section for your app.
- define('OAUTH_TOKEN', '119207660-');
- define('OAUTH_SECRET', '');
- // Start streaming
- $sc = new MyUserConsumer(OAUTH_TOKEN, OAUTH_SECRET);
- $sc->consume();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement