Language English English Español Español Deutsch Deutsch Português Português
🇬🇧 English 🇪🇸 Español 🇩🇪 Deutsch 🇧🇷 Português
Language:EnglishEnglishEspañolEspañolDeutschDeutschPortuguêsPortuguês

using php to update status via the Twitter API – cocktail of the day on Twitter

You can now follow Alex’s Cocktail Making on Twitter @cocktaildaily so I’d love it if you followed me.

I have heard a lot about the twitter API lately being really easy to use and so having hacked things together with the delicious, flickr, eBay, typepad and facebook apis in the past I thought it was time to give twitter a go. The whole development process start to finish took me 25minutes (started at 18:11 and finished at 18:36) from creating a new twitter account to having a daily updating script which pushed a random cocktail with over a certain score and a reasonable likelihood of not being rude to twitter. It took me 12minutes to write this blog post!

For completeness here’s the code I used:

$message = "enter your message here";
$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_POSTFIELDS, "status=$message");
$buffer = curl_exec($curl_handle);
Get my marketing cheat sheets at Click Here

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *