Twitter OAuth Delete Problem
Im having a hard time getting Twitter to delete a status using the PHP OAuth library.
I am using this same method for posting (OAUTH_TYPE_FORM, and OAUTH_HTTP_METHOD_POST), and it works well.
Here is my code for the Delete reques:
$oauth = new OAuth($twitter['CONSUMER_KEY'], $twitter['CONSUMER_SECRET'], OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_FORM);
$oauth->setToken($access_token['oauth_token'], 开发者_运维问答$access_token['oauth_token_secret']);
$oauth->fetch("http://api.twitter.com/1/statuses/destroy/".$delete_id, NULL, OAUTH_HTTP_METHOD_POST);
I keep receiving a 401 Error. Any help please advise :)
Make sure to include the format http://api.twitter.com/version/statuses/destroy/:id.format which can be xml
or json
.
$oauth->fetch("http://api.twitter.com/1/statuses/destroy/".$delete_id.".json", NULL, OAUTH_HTTP_METHOD_POST);
Also, $delete_id
should be stored as a string as it might be too large to be represented as an integer properly in PHP.
ie)
$delete_id = 68090979596505088765 + "";
instead of
$delete_id = 68090979596505088765;
精彩评论