I found out twitter does not support Basic Auth any, and I wonder how
can I change my code from  Basic Auth to OAuth.

and my code like following:

$username=username;
                $password=password;
                $message=message;
                $host = "http://twitter.com/statuses/update.xml";;
                $ch = curl_init();
                curl_setopt($ch, CURLOPT_URL, $host);
                //curl_setopt($ch, CURLOPT_VERBOSE, 1);
                //curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                curl_setopt($ch, CURLOPT_TIMEOUT, $config->timeout );
                curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
                curl_setopt($ch, CURLOPT_POSTFIELDS,"status=$message");
                //curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
                curl_setopt($ch, CURLOPT_POST, 1);
                $result = curl_exec($ch);
                // Look at the returned header
                $resultArray = curl_getinfo($ch);
                curl_close($ch);

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk?hl=en

Reply via email to