Hey Mahmoud, Your code will stop working when Basic Auth is turned off so you will need to change to using OAuth. You may find the following resources helpful in explaining how you can do that:
Converting from Basic Auth to OAuth: http://dev.twitter.com/pages/basic_to_oauth Using a single access token: http://dev.twitter.com/pages/oauth_single_token Some libraries which may be use can be found here: http://dev.twitter.com/pages/oauth_libraries Hope that helps, Matt On Mon, Aug 30, 2010 at 5:08 PM, Mahmoud Sakr <m...@sakr.me> wrote: > 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 > -- Matt Harris Developer Advocate, Twitter http://twitter.com/themattharris -- 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