May 31 / Richard Knop

Zend_Service_Twitter

In the previous post (Working with Twitter API in PHP) I wrote about how to use cURL to communicate with the Twitter API. There is an easier way when you’re using Zend Framework though – Zend_Service_Twitter. Bellow is just a simple example usage.

In the controller:

  1. $twitter = new Zend_Service_Twitter('your_username', 'your_password');
  2. // return last 20 statuses from a user
  3. $this->view->xml = $twitter->status->userTimeline();

In the view (to print the last user’s status):

  1. <p><?php echo $this->escape($this->xml->status[0]->text); ?></p>

For other availale methods read the whole documentation. Also don’t forget to take a look at other APIs the Zend Framework can work with natively (including Akismet, Amazon, Del.icio.us, Flickr, Yahoo and others) here.

2 Comments

leave a comment
  1. john mahugu / Jun 2 2009

    hey, you are pretty impressive – here goes i need 1) PHP oop pdo sqlite results pagination script or even procedural sqlite pagination, 2) sqlite CRUD please get in touch

  2. Richard Knop / Jun 2 2009

    Thanks :)

    1) Personally I use Zend_Paginator for pagination – it works the best with Zend_Db adapter classes (MySQL, SQLite or any other database).

    2) I recommend extending Zend_Db_Table_Abstract class.

Leave a Comment