PHP code example of nticaric / twitter-streaming-api

1. Go to this page and download the library: Download nticaric/twitter-streaming-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nticaric / twitter-streaming-api example snippets



	use Nticaric\Twitter\TwitterStream;

	$stream = new TwitterStream(array(
	    'consumer_key'    => 'my_consumer_key',
	    'consumer_secret' => 'my_consumer_secret',
	    'token'           => 'my_token',
	    'token_secret'    => 'my_token_secret'
	));

	$res = $stream->getStatuses(['track' => 'car'], function($tweet) {
		//prints to the screen statuses as they come along
		print_r($tweet);
	});