How to automatically update Twitter status by PHP

I was wondering how to update my status automatically in twitter using PHP, & found some interesting articles on the internet. I found One all-in-one open-source php project which needed CURL support, but many servers can restrict that access to curl. So with a little help from here & the official Twitter API, I’ve just prepared a working script to Update your Status at twitter automatically 🙂 The best thing is, you don’t need to have CURL enabled! (it will then use fsockopen if CURL is disabled)

Download Code

http://hostcode.sourceforge.net/view/53

How to Use

Once downloaded, save the code in a file like twitter.php

Then use following simple function to automatically update your status:

require_once("twitter.php");
$username = "YOUR-TWITTER-USERNAME";
$password = "YOUR-TWITTER-PASSWORD";
$status = "My First status from the API!";
// encode the status
$status = urlencode($status);
// Tweet it!
$twitter = tweet($username,$password,$status);
// Now you can do additional fun with the data returned at $twitter variable. That's not necessary after all

Troubles? Let me know…… Got help? Cheer me up!