I created a twitter account, and a simple cron job that tweets every certain
period of time.

I fear my authentication mechanism might be affected by tonight's deadline,
is it? I use the following code to send twitter the tweet (the code that is
executed in the cron job)

/**
 * Tweets a new status given a statues, username, and password
 * @param status Status to tweet
 * @param username Username of account to post through
 * @param password Password of account to post through
 * @return void
 */
function tweet($status = 'Hello World', $username, $password) {
$status = urlencode(stripslashes(urldecode($status)));
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://www.twitter.com/statuses/update.xml'
);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, "status=$status");
curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");
curl_exec($curl);
curl_close($curl);
}

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk?hl=en

Reply via email to