/ Published in: PHP
Since the 31 of august 2010, twitter made its API more secure, stopping basic authentication calls.
So, if you used basic authentication you have to change your code and implement oAuth authentication model or you can follow this link and found a mini spider that does the work.
So, if you used basic authentication you have to change your code and implement oAuth authentication model or you can follow this link and found a mini spider that does the work.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function twitterSetStatus($user,$pwd,$status) { if (!function_exists("curl_init")) die("twitterSetStatus needs CURL module, please install CURL on your php."); // ------------------------------------------------------- // get login form and parse it curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3 "); preg_match("/input name=\"authenticity_token\" type=\"hidden\" value=\"(.*?)\"/", $page, $authenticity_token); // ------------------------------------------------------- // make login and get home page // check if login was ok preg_match("/input name=\"authenticity_token\" type=\"hidden\" value=\"(.*?)\"/", $page, $authenticity_token); // ------------------------------------------------------- // send status update $tweet['display_coordinates']=''; $tweet['in_reply_to_status_id']=''; $tweet['lat']=''; $tweet['long']=''; $tweet['place_id']=''; $tweet['text']=$status; return true; }
URL: http://www.barattalo.it/2010/09/09/how-to-change-twitter-status-with-php-and-curl-without-oauth/