PHP code example of ktamashun / callisto

1. Go to this page and download the library: Download ktamashun/callisto 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/ */

    

ktamashun / callisto example snippets


$oauth = new \Callisto\Oauth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
$stream = new \Callisto\Stream\Filter($oauth);
$stream->setRequestParameters(
	[
		// Track custom phrases
		new Callisto\RequestParameter\Track(['twitter']),
		// Filter Tweets by language
		new Callisto\RequestParameter\Language(['en', 'de']),
		// Filter tweets from New York or San Francisco
		new Callisto\RequestParameter\Location(
			[
				[-74, 40, -73, 41],
				[-122.75, 36.8, -121.75, 37.8],
			]
		),
		// Follow specific users
		new Callisto\RequestParameter\Follow(['123456789', '987654321']),
		// Set filter level for the stream
		new Callisto\RequestParameter\FilterLevel(Callisto\RequestParameter\FilterLevel::LOW)
	]
);

foreach ($stream->readStream() as $jsonStatus) {
	echo $jsonStatus;
}