inicio mail me! sindicaci;ón

PHP Class for Accessing Twitter API

I wrote up a quick class for interacting with the twitter API. Right now it returns everything as json, but that would be a five minute project to change out for anyone with m4d sk1||z0rz.

Example usage:

Here’s the function api, which implements most of the commands in the twitter public api:

  • static updateStatus() - update your status on twitter
  • getUpdates() – get the last n updates from twitter
  • getFollowers() – list your twitter friends (people following you)
  • getReplies() – return replies to your posts
  • getFriends() – list friends you follow on twitter
  • sendDirectMessage() – direct message a friend
  • etDirectMessages() – download your direct messages

You’ll want to be sure to set $url_referer to something useful, so you can set the from text for twitter (login required on twitter).

Here’s the whole TwitterUtils.php class, enjoy.

Leave a Comment