Francesc
Francesc

Reputation: 1349

Calculate the number of Tweets in PHP

I want to calculate the number of Tweets of a Twitter Search, and a countup. Just like GigaTweet. How can I calculate this using PHP and the Twitter API?

Upvotes: 3

Views: 946

Answers (1)

Levi Hackwith
Levi Hackwith

Reputation: 9322

There are plenty of documents and PHP libraries out there to assist you with this:

As for the specific method I would use:

Example:

I would then use simplexml (http://www.php.net/simplexml) to parse the atom feed. From there I would use the count method to get the number of "entry" items in that feed.

Please keep in mind that the atom format uses xml namespaces and you'll have to use the children method to retrieve items correctly. More on this can be found here: http://www.sitepoint.com/blogs/2005/10/20/simplexml-and-namespaces/

Upvotes: 3

Related Questions