when I try to update status with Rest API v1.1, it always result error message like this :
HTTP/1.1 100 Continue
HTTP/1.1 400 Bad Request
content-length: 61
content-type: application/json; charset=utf-8
date: Sun, 21 Apr 2013 06:03:39 UTC
server: tfe
set-cookie: guest_id=v1%3A136652421928549286; Domain=.twitter.com; Pa
strict-transport-security: max-age=631138519
{“errors”:[{“message”:“Bad Authentication data”,“code”:215}]}
here my code :
<?php
echo tweet(“hello world !!”);
function tweet($str){
$data = array(‘status’ => urlencode($str));
$header = array(
‘Authorization: OAuth oauth_consumer_key=“3UB9K2sS*******”’,
‘oauth_nonce=“9308b1*****************”’,
‘oauth_signature=“A30NmXdvM%2F0*******”’,
‘oauth_signature_method=“HMAC-SHA1”’,
‘oauth_timestamp="****523799"’,
‘oauth_token="**5009-BtvXPHj6luIqfMH"’,
‘oauth_version=“1.0”’
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, “https://api.twitter.com/1.1/statuses/update.json”);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, “Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)”);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$exec = curl_exec($ch);
curl_close($ch);
return $exec;
}
?>
what the problem ?