Posting updates to twitter using php 0
Do you like twitter a lot like me? It is great yeah… the next BIG thing on the Internet.. maybe?
Oh… In case that you did not add zakeh’s twitter account yet to your twitter friends, then do this here.
Why not sharing your website’s updates or your blog’s RSS with your friends on twitter? That would be awesome for your friends to get notifications on their twitter accounts and getting some sms notifications for your website
Here is a code that might makes this happen
I used the PHP curl features to do the same thing from PHP (obviously with a real username and password):
<?php // Set username and password $username = ‘username’; $password = ‘password’; // The message you want to send $message = ‘is twittering from php using curl’; // The twitter API address $url = ‘http://twitter.com/statuses/update.xml’; // Alternative JSON version // $url = ‘http://twitter.com/statuses/update.json’; // Set up and execute the curl process $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_URL, “$url”); curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_handle, CURLOPT_POST, 1); curl_setopt($curl_handle, CURLOPT_POSTFIELDS, “status=$message”); curl_setopt($curl_handle, CURLOPT_USERPWD, “$username:$password”); $buffer = curl_exec($curl_handle); curl_close($curl_handle); // check for success or failure if (empty($buffer)) { echo ‘message’; } else { echo ’success’; } ?>
Obviously you could do more with the return than print out a success or failure message. The $buffer variable has the returned XML or JSON for you’re parsing pleasure.
The code has been tried many times and it works great on WordPress. Feel free to edit, change, and share the code.
Zakeh Blog









Microsoft has just posted a press release announcing that IE8 will support standards by default, which is a change from what had been previously announced (that IE8 would support IE7 “mode” by default, and render to standards only with the inclusion of a <meta> tag -
The strategy to get its rich Internet app on cell phones is part of Microsoft’s effort to make the browser plug-in a cross-platform, cross-browser product. Microsoft’s bringing Silverlight to cell phones, partnering with Nokia to bring the rich Internet app browser plug-in to devices that use Nokia’s popular S60 software platform. Nokia will also make Silverlight available on its Series 40 devices and its Internet Tablet devices, the companies are expected to announce Tuesday.