Search code examples
phptwittertwitter-streaming-apiphirehose

Phirehose setTrack not working with setLocation


I'm using Phirehose to pull tweets using the Twitter Streaming API. I'm wanting to pull geotagged tweets with certain keywords, like so:

$sc->setLocations(array(array(-180,-90,180,90))); //any geotagged tweet
$sc->setTrack($sc->getKeywords());

getKeywords class function looks like:

public function getKeywords()
{
     $array = array('hurricane', 'flood', 'tornado','tsunami','earthquake');
     return $array; 
}

The problem is that setLocation() seems to cause setTrack() to not pull tweets with those keywords. If I remove setLocation() altogether, setTrack() pulls keywords fine. Is there any way I can pull geotagged tweets containing those keywords?


Solution

  • "The track, follow, and locations fields should be considered to be combined with an OR operator. track=foo&follow=1234 returns Tweets matching “foo” OR created by user 1234."

    As said from Twitter's guys in https://dev.twitter.com/streaming/reference/post/statuses/filter