public function enqueueStatus($status)
    {
        print_r($status);
        $this->tweetCounter++;
        $filePath = './tweet-' . time() . '_' . self::$tweetCounter . '.tweet';
        file_put_contents($filePath, $status);
    }
}
define("TWITTER_CONSUMER_KEY", $tw_consumer_key);
define("TWITTER_CONSUMER_SECRET", $tw_consumer_secret);
// The OAuth data for the twitter account
define("OAUTH_TOKEN", $tw_token);
define("OAUTH_SECRET", $tw_token_secret);
// Start streaming
$sc = new FilterTrackConsumer(OAUTH_TOKEN, OAUTH_SECRET, Phirehose::METHOD_FILTER);
$sc->setLocations(array(array(52.516667 - 0.01, 13.383333 - 0.01, 52.516667 + 0.01, 13.383333 + 0.01)));
$sc->consume();
/* 

if($mainLng==999 && $mainLng==999 && $words[0]["word"]!="*"){

	$qq = "";
	for($i=0 ; $i<count($words) ; $i++){
		$qq = $qq . $words[$i]["word"];
		if($i<count($words)-1){
			$qq = $qq . " OR ";
		}
	}

	$query = "q=" . $qq . "&result_type=recent&count=100";
} else if($mainLng==999 && $mainLng==999 && $words[0]["word"]=="*"){
예제 #2
0
 */
class FilterTrackConsumer extends OauthPhirehose
{
    /**
     * Enqueue each status
     *
     * @param string $status
     */
    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.
         */
        $data = json_decode($status, true);
        if (is_array($data) && isset($data['user']['screen_name'])) {
            print $data['user']['screen_name'] . ': ' . urldecode($data['text']) . "\n";
        }
    }
}
// The OAuth credentials you received when registering your app at Twitter
define("TWITTER_CONSUMER_KEY", "ot0tUgarTYxEBCQrRynDgdMKr");
define("TWITTER_CONSUMER_SECRET", "iUtFcLdY2fDq9jGqIQLfIaXG8ROYHAKv3OMNOtJIVzDZsWztoY");
// The OAuth data for the twitter account
define("OAUTH_TOKEN", "2816508089-1ImNswhZ0uEhq7xBwUAmZpF5hfGDcez4qbVokqN");
define("OAUTH_SECRET", "sf4EVHZ5A3UEv0Tf1Wun4w9jcQq7sHKfUkQUEZSjioXxh");
// Start streaming
$sc = new FilterTrackConsumer(OAUTH_TOKEN, OAUTH_SECRET, Phirehose::METHOD_FILTER);
$sc->setLocations(array(array(12.5685, 55.6754, 12.5913, 55.6882)));
$sc->consume();
예제 #3
0
     * Enqueue each status
     *
     * @param string $status
     */
    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.
         */
        $data = json_decode($status, true);
        if (is_array($data) && isset($data['user']['screen_name'])) {
            print $data['user']['screen_name'] . ': ' . urldecode($data['text']) . "\n";
            $this->push_data_to_db($data);
            //$this->AutoTranslate($data);
        }
    }
}
// The OAuth credentials you received when registering your app at Twitter
define("TWITTER_CONSUMER_KEY", "your twitter consumer key");
define("TWITTER_CONSUMER_SECRET", "Your twitter consumer secret");
// The OAuth data for the twitter account
define("OAUTH_TOKEN", "your twitter application token");
define("OAUTH_SECRET", "your twitter application secret");
// Start streaming
$sc = new FilterTrackConsumer(OAUTH_TOKEN, OAUTH_SECRET, Phirehose::METHOD_FILTER);
$sc->setLocations(array(array(-0.5103, 51.2868, 0.334, 51.6923)));
$sc->setTrack(array('@5liveSport', '@SW_Trains', '@GiveBloodNHS', '@BBCSport', '@bbcweather', '@ukhomeoffice', '@AboutTheBBC', '@EnvAgency', '@NHSEnglandLDN', '@TimeOutLondon', '@CityofLdnOnt', '@BBC', '@GOVUK', '@cityoflondon', '@bbc5live', '@SkyNews', '@BBCBreaking', '@FinancialTimes', '@bbcworldservice', '@BBCWorld', '@BBCNews', '@LondonSHP', '@metpoliceuk', '#LondonTraffic', '@londontraffic', '@TfLTrafficNews', '@LDNTraffic', '@WazeTrafficLON', '@TfLBusAlerts'));
$sc->setFollow(array(47331384, 31129844, 22906929, 1155611857, 338237494, 3216970444.0, 400051029));
$sc->consume();
            $collection->insert($refinedData);
        }
        //print $refinedData['user_screen_name'] . ': ' . $refinedData['text'] . "\n";
        /*$myFile = fopen('tweetsWithUppsala.json', 'a');
          fwrite($myFile, $refinedJSON . "\n");
          fclose($myFile);*/
    }
}
function coordInUppsala($coordinates)
{
    if ($coordinates[0] > 17.51 && $coordinates[0] < 17.8) {
        if ($coordinates[1] > 59.79 && $coordinates[1] < 59.91) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
// The OAuth credentials you received when registering your app at Twitter
define("TWITTER_CONSUMER_KEY", "UhAWWHnOa8pHU78FgYaHmWEQN");
define("TWITTER_CONSUMER_SECRET", "qaXWnC2aQ3BmABbMYVDiOQ2EXij9SOBauVIx25YLbuKo47srhO");
// The OAuth data for the twitter account
define("OAUTH_TOKEN", "3150881842-bxomhSUyXuvGy12WAdq5uBz7OUwPi9qwMuebza6");
define("OAUTH_SECRET", "PebJAPeR2ej1fkzRg8nZfVffNCgOQpuUgeXTC8eFT3T9K");
// Start streaming
$sc = new FilterTrackConsumer(OAUTH_TOKEN, OAUTH_SECRET, Phirehose::METHOD_FILTER);
$sc->setTrack(array('uppsala'));
$sc->setLocations(array(array(17.51, 59.79, 17.8, 59.91)));
$sc->consume();
예제 #5
0
<?php

require_once '../lib/Phirehose.php';
/**
 * Example of using Phirehose to display a live filtered stream using geo locations
 */
class FilterTrackConsumer extends Phirehose
{
    /**
     * Enqueue each status
     *
     * @param string $status
     */
    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.
         */
        $data = json_decode($status, true);
        if (is_array($data) && isset($data['user']['screen_name'])) {
            print $data['user']['screen_name'] . ': ' . urldecode($data['text']) . "\n";
        }
    }
}
// Start streaming
$sc = new FilterTrackConsumer('username', 'password', Phirehose::METHOD_FILTER);
$sc->setLocations(array(array(-122.75, 36.8, -121.75, 37.8), array(-74, 40, -73, 41)));
$sc->consume();
예제 #6
0
     * Enqueue each status
     *
     * @param string $status
     */
    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.
         */
        $data = json_decode($status, true);
        if (is_array($data) && isset($data['user']['screen_name'])) {
            print $data['user']['screen_name'] . ': ' . urldecode($data['text']) . "\n";
            $this->push_data_to_db($data);
            // $this->AutoTranslate($data);
        }
    }
}
// The OAuth credentials you received when registering your app at Twitter
define("TWITTER_CONSUMER_KEY", "your twitter consumer key");
define("TWITTER_CONSUMER_SECRET", "Your twitter consumer secret");
// The OAuth data for the twitter account
define("OAUTH_TOKEN", "your twitter application token");
define("OAUTH_SECRET", "your twitter application secret");
// Start streaming
$sc = new FilterTrackConsumer(OAUTH_TOKEN, OAUTH_SECRET, Phirehose::METHOD_FILTER);
$sc->setLocations(array(array(10.18, 56.142, 10.234, 56.1721)));
$sc->setTrack(array('@StiftenAGF', '@jpaarhus', '#Aarhus', '@AarhusKultur', '@smagaarhus', '@AarhusNyheder', '@AarhusPortaldk', '@Aarhus2017', '@OpenDataAarhus', '@aarhusupdate', '@AskVest', '@SundhedOgOmsorg', '@ArhusVejr', '@aarhus_ints', '@AGFFANdk', '@AarhusCykelby', '@VisitAarhus', '@larshaahr'));
$sc->setFollow(array(3601200017.0, 3370065087.0, 3330970365.0, 2911388001.0, 2706568231.0, 2647614595.0, 2201213730.0, 1324132976, 1065597596, 210987829, 159110346, 112585923, 77749562, 38227253, 36040150));
$sc->consume();