How to update twitter status using php
The following lines of code are used to update your status in twitter.
//Text to be updated on twitter $status = "Hi this is the text to be updated"; //your twitter username $username = "xxxxusername"; //your twitter password $password = "password"; $postvars = "status=".$status; $url = "http://twitter.com/statuses/update.xml";</code> $ch = curl_init($url); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_HEADER, 0); // DO NOT RETURN HTTP HEADERS curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // RETURN THE CONTENTS OF THE CALL $res=curl_exec($ch); curl_close($ch);