As the title says, I’d like to insert a stream on some webpages (written in PHP) showing the latest tweets with a certain hashtag (different from a page to page).
Is that possible? How?
At the moment, I’m able to retrieve tweets with a certain hashtag through “search” REST APIs; but if a new tweet with the desired hashtag is inserted while a page is open, it isn’t showed. So, can the streaming API help me in this?
Same questiong here. Have you sloved this anyway?
@Danielauz / @leviatan89, the streaming API can help you with this. I haven’t used PHP in a while but you will need to figure out how to background task the stream connection.
As the Tweets come in you have two options:
-
Store them in a database or data store like redis. From your front-end javascript application poll an endpoint that returns new Tweets added to your data store.
-
Use a web socket connection to push the Tweets to your front-end javascript application. Again, not sure if PHP has socket support, but I’m sure there are libs our there. This is my favored approach.