I am trying to use your api to update user status and have followed your twitter example but I am stucked with an error.
Here's the code I am using
$client = new oauth_client_class;
$client->debug = 1;
$client->debug_http = 1;
$client->server = 'Twitter';
$client->redirect_uri = 'https://'.$_SERVER['HTTP_HOST'].
$client->client_id = 'twitter_id_here..'; $application_line = __LINE__;
$client->client_secret = 'twitter_secret_here';
if(strlen($client->client_id) == 0
|| strlen($client->client_secret) == 0)
die('Please go to Twitter Apps page https://dev.twitter.com/apps/new , '.
'create an application, and in the line '.$application_line.
' set the client_id to Consumer key and client_secret with Consumer secret. '.
'The Callback URL must be '.$client->redirect_uri);
if(($success = $client->Initialize()))
if(($success = $client->Process()))
/*$success = $client->CallAPI(
'GET', array(), array('FailOnAccessError'=>true), $user);*/
$success = $client->CallAPI(
,array('status'=>'This is a test tweet to evaluate the PHP OAuth API support update twitter status sent at '.strftime("%Y-%m-%d %H:%M:%S")
$success = $client->Finalize($success);
echo "<pre>";print_r($client);echo "</pre>";
And here's the debug output:
[debug_output] => OAuth client: Checking the OAuth token authorization state
OAuth client: The OAuth token was already authorized
OAuth client: Accessing the API call at https://api.twitter.com/1.1/statuses/update
OAuth client: Could not retrieve the OAuth access token. Error: it was not possible to access the API call: it was returned an unexpected response status 401 Response:
And here are the errors inside $client
[access_token_error] => it was not possible to access the API call: it was returned an unexpected response status 401 Response:
[response_status] => 401
it says that "The OAuth token was already authorized" but why is it that I am having an "access_token_error"?
Where did I go wrong?
|2013-07-06 02:06:53 - In reply to message 1 from Ecxzqute Rhaiga|
|You probably need to create an application that has write permissions to post in the user timeline.|
Go in https://dev.twitter.com/apps and check the Twitter application you created. If the Access level value is set to read-only, you cannot use that application for posting in the user timeline.
In that case you need to create a new application with write permissions.
|2013-07-06 03:45:46 - In reply to message 2 from Manuel Lemos|
|Sorry to have forgotten to include twitter app settings in my previous post. |
Yes, I have set my twitter app to have Read, Write and Access direct messages permissions.
From Application Details
Access level Read, write, and direct messages
Your access token
Access token 111811793-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Access token secret WXEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Access level Read and write
|2013-07-06 11:45:59 - In reply to message 3 from Ecxzqute Rhaiga|
|There was a bug that was preventing to set the access token secret. The bug is fixed and the new version was just uploaded. Just let me know if that does not address your problem.|