How to post msg on twitter using php -
my below script posting msg not working. can me in this?
$username = ($_post['t_user']); $password = ($_post['t_pass']); $message = ($_post['t_update']); $url = 'http://twitter.com/statuses/update.xml'; $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); if (empty($buffer)) { echo "<p align=\"center\" >".'sorry, due error twitter status not updated! please check username/password!'."</p>"; } else { echo "<p align=\"center\">".'your twitter status has been updated!'."</p>"; }
you can inspire tutorial:
creating simple twitter app using oauth , php
http://www.1stwebdesigner.com/tutorials/twitter-app-oauth-php/
Comments
Post a Comment