Why can't I update our Twitter status?

I spent the last three hours trying to get a simple Twitter status update using Zend_Service_Twitterand Zend_Oauth_Token_Access. Restlessly, I keep getting the following answer:

object(Zend_Rest_Client_Result)#34 (2) {
  ["_sxml:protected"]=>
  object(SimpleXMLElement)#39 (2) {
    ["request"]=>
    string(33) "/1/account/verify_credentials.xml"
    ["error"]=>
    string(20) "Invalid / used nonce"
  }
  ["_errstr:protected"]=>
  NULL
}

Here is the code I tried:

$token = new Zend_Oauth_Token_Access();
$token->setToken('my token');
$token->setTokenSecret('my token secret');

$params = array('accessToken' => $token,
                'consumerKey' => 'my key',
                'consumerSecret' => 'my secret'
               );
$twitter = new Zend_Service_Twitter($params);

$response = $twitter->statusUpdate('simpletest');

What on earth is "nons"? If I ruin the secret of the token / token, the error message in the response will be changed accordingly. However, with the correct credentials, I continue to receive the aforementioned non-return (pun intended). In addition, I tried several alternatives, such as this previous post in SO format .

Any help would be appreciated!

Update:

, , , Twitter, Twitter. @David Caunt , , "" , Twitter , . ! , oAuth API (, , Zend_Service_Twitter ).

+3
2

, , Zend_Service_Twitter.

$twitter = new Zend_Service_Twitter(array(
    'username' => 'johndoe',
    'accessToken' => $token
));
$response   = $twitter->status->update('My Great Tweet');

, , .

. , nonce.

UPDATE:

, , .

GitHub gist. , MVC .

, Zend_Http_Client, , .

+2

Twitter , .

OAuth , , "/ nonce" .

, %20 +. .

Twitter , .

, , , ( )... , - googling "/ , .

http://code.google.com/p/twitter-api/issues/detail?id=1059 ( )

+1

Source: https://habr.com/ru/post/1769006/


All Articles