我通过用户名和密码更新Twitter状态时遇到问题。使用CURL更新Twitter状态
这里是代码为:
$username = 'username';
$password = 'password';
$message = 'Testing';
$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_HTTPAUTH, CURLAUTH_BASIC); //basic authentication
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);
echo $buffer;
这不是只有一个用户,这样我可以不使用OAuth(使用消费密钥和其他标记方式)。我已经试过这个:http://www.1stwebdesigner.com/tutorials/how-to-update-twitter-using-php-and-twitter-api/但我不能传递多个用户的用户名和密码来更新多个twitter状态。
请帮我解决这个问题。
当我已经使用这个代码卷曲,然后它会显示错误:“不支持基本身份验证”,让你能帮助我在此。 – Anjara 2011-01-05 07:37:26