Zend Framework 101: Zend_Oauth
In this article I will introduce you to the Zend_Oauth component of the Zend Framework. This component implements the OAuth standard, allowing users to access protected data on other sites.
To demonstrate how to use this component, we're going to create a basic script that allows a user to log in to their Twitter account and post a status update. Twitter is currently phasing out "basic authentication" and requiring all third-party web and desktop applications use OAuth.
This article can be used as a starting point for creating (or updating existing) Twitter API apps. We will also be using the Zend_Service_Twitter component, as I covered in a previous screencast.
This article requires Zend Framework, downloadable from http://framework.zend.com. At time of writing, the current version of Zend Framework is 1.10.6. There have been many changes recently to how integrates with Zend_Oauth, so using this latest version is highly recommended.
This article also uses Zend_Db to connect with a MySQL database. The pdo_mysql extension must be available on your server for this to work. There isn't much database access code, so if you require different database access code there are only a few lines to update.
We also make basic use of Zend_Db_Select to build an SQL query, as well as Zend_Session for session management. For more details about Zend_Session read Zend Framework 101: Zend_Session.