Zend_Service_Twitter - Make API v1.1 ready

raju

New Member
The Zend_Service_Twitter component is still for Twitters API v1.0 which will be deprecated at 5th March 2013. So I wanted to make my new website with Twitter API interaction v1.1 ready. Everything works fine with v1.0 but if I change the URL from \[code\]/1/\[/code\] to \[code\]/1.1/\[/code\] it fails with the HTTP header code 400 and the JSON error message: \[code\]Bad Authentication data\[/code\] (Code: 215)To get the request and access token stayed the same and works already without any changes,but if I want to verify the credentials like this I get the error I described above:\[code\]// Take a look for the code here: http://framework.zend.com/manual/1.12/en/zend.oauth.introduction.html$accessToken = $twitterAuth->getAccessToken($_GET, unserialize($_SESSION['TWITTER_REQUEST_TOKEN']));// I have a valid access token and now the problematic part$twitter = new Zend_Service_Twitter(array( 'username' => $accessToken->getParam('screen_name'), 'accessToken' => $accessToken));print_r($twitter->account->verifyCredentials());\[/code\]I changed the code of verifyCredentials in \[code\]Zend/Service/Twitter.php\[/code\] from that to that:\[code\]public function accountVerifyCredentials(){ $this->_init(); $response = $this->_get('/1/account/verify_credentials.xml'); return new Zend_Rest_Client_Result($response->getBody());}// topublic function accountVerifyCredentials(){ $this->_init(); $response = $this->_get('/1.1/account/verify_credentials.json'); return Zend_Json::decode($response->getBody());}\[/code\]Now I added before the \[code\]return Zend_Json[...]\[/code\] this line:\[code\]print_r($this->_localHttpClient->getLastRequest());// And I get this output of it:GET /1.1/account/verify_credentials.json HTTP/1.1Host: api.twitter.comConnection: closeAccept-encoding: gzip, deflateUser-Agent: Zend_Http_ClientAccept-Charset: ISO-8859-1,utf-8Authorization: OAuth realm="",oauth_consumer_key="",oauth_nonce="91b6160db351060cdf4c774c78e2d0f2",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1349107209",oauth_version="1.0",oauth_token="hereismytoken",oauth_signature="hereisavalidsignature"\[/code\]As you could see the \[code\]oauth_consumer_key\[/code\] (and \[code\]realm\[/code\] too) is empty. Could that be the error? How could I solve this error (because of the stricter new API version?)? Would it be fine to set somehow the \[code\]oauth_consumer_key\[/code\]? If yes, how could I manage that?
 
Top