3

I've upgraded to Zend Framework v1.12.3 because it supports the TwitterAPI v1.1 with Zend_Service_Twitter. Before, I've used the TwitterAPI 1.0 (prior ZF 1.12.3) which works well, but that's gonna change in march 2013.

If I call the TwitterAPI v1.1 with the following ZF 1.12.3 code, I keep getting a strange error which I can't explain to myself:

Code:

     $twitterService = new Zend_Service_Twitter(array(
            'consumerKey'    => $this->config['consumerKey'],
            'consumerSecret' => $this->config['consumerSecret'],
            'username'       => $twitterVO->getTwitterUserName(),
            'accessToken'    => $accessToken // unserialized object
));

 $response = $twitterService->statusesUpdate("TEST");

And that's the error which I get. It doesn't matter which function I call (in this case it's statusesUpdate("Test")):

enter image description here

The message is "Invalid chunk size "" unable to read chunked body". The "type" attribute within the array shows a "->". That's also a bit suspect but I couldn't find out where it comes from.

Does anyone have a working example with Zend Framework 1.12.3?

3

Since ZF 1.12, the Twitter app Oauth parameters can be given in the Zend_Service_Twitter constructor, but consumerKey and consumerSecret must go under the "oauthOptions" array.

This works for me:

$accessToken = new Zend_Oauth_Token_Access();
$accessToken->setToken('YourAccessToken');
$accessToken->setTokenSecret('YourAccessTokenSecret');

$twitter = new Zend_Service_Twitter(
    array(
        'username' => 'YourUsername',
        'accessToken' => $accessToken,
        'oauthOptions' => array(
            'consumerKey' => 'YourConsumerKey',
            'consumerSecret' => 'YourConsumerSecret'
        )
    )
);

$result = $twitter->statusesUserTimeline('TEST');
  • Thanks, arraintxo. That's the solution! – ninsky May 1 '13 at 11:10

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.