Zend_Service_TwitterIntroductionZend_Service_Twitter fournit un client pour » l'API REST de Twitter. Zend_Service_Twitter vous permet d'interroger les fils (timeline) publics. En fournissant un nom d'utilisateur et un mot de passe pour Twitter, il vous permettra également de récupérer et mettre à jour votre statut, de répondre à des amis, de leur envoyer des messages directs, de marquer des tweets comme favoris et beaucoup d'autres choses. Zend_Service_Twitter implémente un service REST, et toutes ses méthodes retournes une instance de Zend_Rest_Client_Result. Zend_Service_Twitter et subdivisé en sections, ainsi vous pouvez facilement identifier le type d'appel qui est demandé.
AuthentificationA l'exception de la récupération du fil public, Zend_Service_Twitter nécessite une authentification pour fonctionner. Twitter utilise l'» Authentification HTTP basique. Vous pouvez lui passer votre nom d'utilisateur ou votre email utilisé pour l'enregistrement de votre compte ainsi que votre mot de passe pour vous connecter à Twitter. Example #1 Créer la classe Twitter L'exemple de code suivant décrit comment créer le service Twitter, lui passer vos nom d'utilisateur et mot de passe et vérifier qu'ils sont corrects.
Vous pouvez également passer un tableau qui contient le nom d'utilisateur et le mot de passe en tant que premier argument
Account Methods
Status Methods
User Methods
Direct Message Methods
Friendship Methods
Favorite Methods
Block Methods
Zend_Service_Twitter_SearchIntroductionZend_Service_Twitter_Search provides a client for the » Twitter Search API. The Twitter Search service is use to search Twitter. Currently, it only returns data in Atom or JSON format, but a full REST service is in the future, which will support XML responses. Twitter TrendsReturns the top ten queries that are currently trending on Twitter. The response includes the time of the request, the name of each trending topic, and the url to the Twitter Search results page for that topic. Currently the search API for trends only supports a JSON return so the function returns an array.
The return array has two values in it:
Searching TwitterUsing the search method returns tweets that match a specific query. There are a number of » Search Operators that you can use to query with. The search method can accept six different optional URL parameters passed in as an array:
Example #29 JSON Search Example The following code sample will return an array with the search results.
Example #30 ATOM Search Example The following code sample will return a Zend_Feed_Atom object.
Zend-specific Accessor MethodsWhile the Twitter Search API only specifies two methods, Zend_Service_Twitter_Search has additional methods that may be used for retrieving and modifying internal properties.
|
|