0

I found that we can use stream API to get the latest tweets based on hash tags or keywords.

It says you have to keep your http connection open. I am having a doubt regarding this.

Can anyone give me an example of stream API in php?

And other thing can I skip hashtag and keyword parameter is this API ? So I can all the statuses?

Can I pass a parameter like latitude and longitude to get tweets from the specific region?

keen
  • 3,001
  • 4
  • 34
  • 59

1 Answers1

1

You can request tweets by location, see their API documentation for specifying location boundaries: https://dev.twitter.com/docs/streaming-apis/parameters#locations

flauntster
  • 2,008
  • 13
  • 20
  • will this fetch me latest tweets or tweets in order how it's done? – keen Jan 24 '14 at 06:07
  • i believe it gives latest tweets that match the boundaries you specify, ordered by newest first. it won't return retweets or tweets from protected users. – flauntster Jan 24 '14 at 06:12
  • Thanks for this. do u have any example for this because stream API is different than others. and i haven't used stream API ever? – keen Jan 24 '14 at 06:16
  • This looks to be a very simple example which you can expand upon, and adjust the query to include location parameters as per the API documentation :) http://code.skyrocket.be/post/19736067936/consuming-the-twitter-streaming-api-with-php – flauntster Jan 24 '14 at 06:35
  • Yes Even I found this but they seems to use API 1.0 which is deprecated now. So now it would be totally different process for this. – keen Jan 24 '14 at 06:38
  • Yeh API 1.1 requires that you register as a developer (free) and get access keys, and use oAuth to authorize the API calls. There's alot of good information on how this is done here - http://stackoverflow.com/questions/12916539/simplest-php-example-for-retrieving-user-timeline-with-twitter-api-version-1-1 :) – flauntster Jan 24 '14 at 06:53
  • I am using this example http://mikepultz.com/2013/06/mining-twitter-api-v1-1-streams-from-php-with-oauth/ It's working but what should I change to make it work with location API ? I tried to add location parameter but it give authentication error. – keen Jan 24 '14 at 11:26