Friday, December 10, 2010

Twitter, Oauth and Zend_Service_Twitter

Here's a simple way to connect to Twitter, using Oauth, in case you need to access it via just one user.

// get the xxx es from your app details in Twitter

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

$tcl = new Zend_Service_Twitter(array(
'accessToken' => $accessToken,
'consumerKey' => 'xxx',
'consumerSecret' => 'xxx'
));


Bonus:

If you get the "Timestamp out of bounds" error. First check your server time. It was 30 minutes back, and that cost me 3 hours of googling.

No comments:

Post a Comment