Example of StreamingAPI



I need an example of how to use the StreamingAPI. I am currently using the REST_API to get hashtag posts, but it only brings up five posts. I know by using the StreamingAPI I can get more, but do not know how to use it.

Sample of code:


<h1>This is the beginning of the page</h1>
ini_set('display_errors', 1);

/** Set access tokens here - see: https://dev.twitter.com/apps/ **/
$settings = array(
    'oauth_access_token' => "",
    'oauth_access_token_secret' => "",
    'consumer_key' => "",
    'consumer_secret' => ""

$url = 'https://stream.twitter.com/1.1/statuses/filter.json';
$requestMethod = "GET";
$getfield = '?track=twitter';
$twitter = new TwitterAPIExchange($settings);
echo $string = json_decode($twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest(),$assoc = TRUE);

My code is a little messed up since I moved stuff around. How can I do this?


I haven’t personally used it but this repo seems to be pretty commonly used and would likely help you: https://github.com/fennb/phirehose