Translate

Image of RHCE Red Hat Certified Engineer Linux Study Guide (Exam RH302) (Certification Press)
Image of Advanced Programming in the UNIX Environment, Second Edition (Addison-Wesley Professional Computing Series)
Image of Beginning Google Maps API 3
Image of Modern Operating Systems (3rd Edition)

Update Twitter Status using PHP and OAuth

Prior to Twitter requiring the use of OAuth to authenticate a user, it was possible to update your status on Twitter using PHP and your Twitter username and password credentials. Probably the most popular way to do this was to use Curl as shown in the following example: <?php $username = ‘your_twitter_username’; $password = ‘your_twitter_password’; $message = ‘Using PHP and curl to update my status’; $url = ‘http://twitter.com/statuses/update.xml’; $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_POST, 1); curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$message"); curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password"); curl_setopt($curl_handle, CURLOPT_URL, "$url"); curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); $status = curl_exec($curl_handle); curl_close($curl_handle); print_r($status); ?> This method of authentication using