Zend_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é.
        
- 
                
accounts'assure que vos données de compte sont valides, vérifie votre taux limite pour l'API et termine la session courante pour l'utilisateur authentifié. - 
                
statusretourne les fils publics et ceux de l'utilisateur et montre, met à jour, détruit et retourne des réponses pour l'utilisateur authentifié. - 
                
userrécupère les amis et 'followers' de l'utilisateur authentifié et retourne de plus amples informations sur l'utilisateur passé en paramètre. - 
                
directMessagerécupère les messages directs reçus par l'utilisateur authentifié, supprime les messages directs et permet également d'envoyer des messages directs. - 
                
friendshipcrée et supprime des amitiés pour l'utilisateur authentifié. - 
                
favoriteliste, crée et détruit des tweets favoris. - 
                
blockbloque et débloque des utilisateurs qui vous suivent. 
            A 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.
        
Exemple 804. 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.
$twitter = new Zend_Service_Twitter('myusername', 'mysecretpassword');
// vérifie vos données de connexion avec Twitter
$response = $twitter->account->verifyCredentials();
            Vous pouvez également passer un tableau qui contient le nom d'utilisateur et le mot de passe en tant que premier argument
$userInfo   = array('username' => 'foo', 'password' => 'bar');
$twitter    = new Zend_Service_Twitter($userInfo);
// vérifie vos données de connexion avec Twitter
$response = $twitter->account->verifyCredentials();
        - 
                
rateLimitStatus()returns the remaining number of API requests available to the authenticating user before the API limit is reached for the current hour.Exemple 806. Rating limit status
$twitter = new Zend_Service_Twitter($options); $response = $twitter->application->rateLimitStatus(); $userTimelineLimit = $response->resources->statuses->{'/statuses/user_timeline'}->remaining;
 
- 
                
create()blocks the user specified in theidparameter as the authenticating user and destroys a friendship to the blocked user if one exists. Returns the blocked user when successful.Exemple 807. Blocking a user
$twitter = new Zend_Service_Twitter($options); $response = $twitter->blocks->create('usertoblock');
 - 
                
destroy()un-blocks the user specified in theidparameter for the authenticating user. Returns the un-blocked user in the requested format when successful.Exemple 808. Removing a block
$twitter = new Zend_Service_Twitter($options); $response = $twitter->blocks->destroy('blockeduser');
 - 
                
ids()returns an array of user identifiers that the authenticating user is blocking.Exemple 809. Who are you blocking (identifiers only)
$twitter = new Zend_Service_Twitter($options); $response = $twitter->blocks->ids();
 - 
                
list()returns an array of user objects that the authenticating user is blocking.Exemple 810. Who are you blocking
$twitter = new Zend_Service_Twitter($options); $response = $twitter->blocks->list();
 
- 
                
messages()returns a list of the 20 most recent direct messages sent to the authenticating user.Exemple 811. Retrieving recent direct messages received
$twitter = new Zend_Service_Twitter($options); $response = $twitter->directMessages->messages();
The
messages()method accepts an array of optional parameters to modify the query.- 
                        
since_idnarrows the returned results to just those statuses after the specified identifier (up to 24 hours old). - 
                        
max_idnarrows the returned results to just those statuses earlier than the specified identifier. - 
                        
countspecifies the number of statuses to return, up to 200. - 
                        
skip_status, when set to boolean true, "t", or 1 will skip including a user's most recent status in the results. - 
                        
include_entitiescontrols whether or not entities, which includes URLs, mentioned users, and hashtags, will be returned. 
 - 
                        
 - 
                
sent()returns a list of the 20 most recent direct messages sent by the authenticating user.Exemple 812. Retrieving recent direct messages sent
$twitter = new Zend_Service_Twitter($options); $response = $twitter->directMessages->sent();
The
sent()method accepts an array of optional parameters to modify the query.- 
                        
countspecifies the number of statuses to return, up to 20. - 
                        
pagespecifies the page of results to return, based on thecountprovided. - 
                        
since_idnarrows the returned results to just those statuses after the specified identifier (up to 24 hours old). - 
                        
max_idnarrows the returned results to just those statuses earlier than the specified identifier. - 
                        
include_entitiescontrols whether or not entities, which includes URLs, mentioned users, and hashtags, will be returned. 
 - 
                        
 - 
                
new()sends a new direct message to the specified user from the authenticating user. Requires both the user and text parameters below.Exemple 813. Sending a direct message
$twitter = new Zend_Service_Twitter($options); $response = $twitter->directMessages->new('myfriend', 'mymessage');
 - 
                
destroy()destroys the direct message specified in the requiredidparameter. The authenticating user must be the recipient of the specified direct message.Exemple 814. Deleting a direct message
$twitter = new Zend_Service_Twitter($options); $response = $twitter->directMessages->destroy(123548);
 
- 
                
list()returns the 20 most recent favorite statuses for the authenticating user or user specified by theuser_idorscreen_nameparameter.Exemple 815. Retrieving favorites
$twitter = new Zend_Service_Twitter($options); $response = $twitter->favorites->list();
The
list()method accepts an array of optional parameters to modify the query.- 
                        
user_idspecifies the ID of the user for whom to return the timeline. - 
                        
screen_namespecifies the screen name of the user for whom to return the timeline. - 
                        
since_idnarrows the returned results to just those statuses after the specified identifier (up to 24 hours old). - 
                        
max_idnarrows the returned results to just those statuses earlier than the specified identifier. - 
                        
countspecifies the number of statuses to return, up to 200. - 
                        
include_entitiescontrols whether or not entities, which includes URLs, mentioned users, and hashtags, will be returned. 
 - 
                        
 - 
                
create()favorites the status specified in theidparameter as the authenticating user.Exemple 816. Creating a favorite
$twitter = new Zend_Service_Twitter($options); $response = $twitter->favorites->create(12351);
 - 
                
destroy()un-favorites the status specified in theidparameter as the authenticating user.Exemple 817. Deleting favorites
$twitter = new Zend_Service_Twitter($options); $response = $twitter->favorites->destroy(12351);
 
- 
                
create()befriends the user specified in theidparameter with the authenticating user.Exemple 818. Creating a friend
$twitter = new Zend_Service_Twitter($options); $response = $twitter->friendships->create('mynewfriend');
 - 
                
destroy()discontinues friendship with the user specified in theidparameter and the authenticating user.Exemple 819. Deleting a friend
$twitter = new Zend_Service_Twitter($options); $response = $twitter->friendships->destroy('myoldfriend');
 
- 
                
tweets()returns a list of tweets matching the criteria specified in$query. By default, 15 will be returned, but this value may be changed using thecountoption.Exemple 820. Searching for tweets
$twitter = new Zend_Service_Twitter($options); $response = $twitter->search->tweets('#zendframework');
The
tweets()method accepts an optional second argument, an array of optional parameters to modify the query.- 
                        
since_idnarrows the returned results to just those statuses after the specified identifier (up to 24 hours old). - 
                        
max_idnarrows the returned results to just those statuses earlier than the specified identifier. - 
                        
countspecifies the number of statuses to return, up to 200. - 
                        
include_entitiescontrols whether or not entities, which includes URLs, mentioned users, and hashtags, will be returned. - 
                        
langindicates which two-letter language code to restrict results to. - 
                        
localeindicates which two-letter language code is being used in the query. - 
                        
geocodecan be used to indicate the geographical radius in which tweets should originate; the string should be in the form "latitude,longitude,radius", with "radius" being a unit followed by one of "mi" or "km". - 
                        
result_typeindicates what type of results to retrieve, and should be one of "mixed," "recent," or "popular." - 
                        
untilcan be used to specify a the latest date for which to return tweets. 
 - 
                        
 
- 
                
sample()returns the 20 most recent statuses from non-protected users with a custom user icon. The public timeline is cached by Twitter for 60 seconds.Exemple 821. Retrieving public timeline
$twitter = new Zend_Service_Twitter($options); $response = $twitter->statuses->sample();
 - 
                
homeTimeline()returns the 20 most recent statuses posted by the authenticating user and that user's friends.Exemple 822. Retrieving the home timeline
$twitter = new Zend_Service_Twitter($options); )); $response = $twitter->statuses->homeTimeline();
The
homeTimeline()method accepts an array of optional parameters to modify the query.- 
                        
since_idnarrows the returned results to just those statuses after the specified identifier (up to 24 hours old). - 
                        
max_idnarrows the returned results to just those statuses earlier than the specified identifier. - 
                        
countspecifies the number of statuses to return, up to 200. - 
                        
trim_user, when set to boolean true, "t", or 1, will list the author identifier only in embedded user objects in the statuses returned. - 
                        
contributor_details, when set to boolean true, will return the screen name of any contributors to a status (instead of only the contributor identifier). - 
                        
include_entitiescontrols whether or not entities, which includes URLs, mentioned users, and hashtags, will be returned. - 
                        
exclude_repliescontrols whether or not status updates that are in reply to other statuses will be returned. 
 - 
                        
 - 
                
userTimeline()returns the 20 most recent statuses posted from the authenticating user.Exemple 823. Retrieving user timeline
$twitter = new Zend_Service_Twitter($options); $response = $twitter->statuses->userTimeline();
The
userTimeline()method accepts an array of optional parameters to modify the query.- 
                        
user_idspecifies the ID of the user for whom to return the timeline. - 
                        
screen_namespecifies the screen name of the user for whom to return the timeline. - 
                        
since_idnarrows the returned results to just those statuses after the specified identifier (up to 24 hours old). - 
                        
max_idnarrows the returned results to just those statuses earlier than the specified identifier. - 
                        
countspecifies the number of statuses to return, up to 200. - 
                        
trim_user, when set to boolean true, "t", or 1, will list the author identifier only in embedded user objects in the statuses returned. - 
                        
contributor_details, when set to boolean true, will return the screen name of any contributors to a status (instead of only the contributor identifier). - 
                        
include_rtscontrols whether or not to include native retweets in the returned list. - 
                        
exclude_repliescontrols whether or not status updates that are in reply to other statuses will be returned. 
 - 
                        
 - 
                
show()returns a single status, specified by theidparameter below. The status' author will be returned inline.Exemple 824. Showing user status
$twitter = new Zend_Service_Twitter($options); $response = $twitter->statuses->show(1234);
 - 
                
update()updates the authenticating user's status. This method requires that you pass in the status update that you want to post to Twitter.Exemple 825. Updating user status
$twitter = new Zend_Service_Twitter($options); $response = $twitter->statuses->update('My Great Tweet');
The
update()method accepts a second additional parameter.- 
                        
inReplyToStatusIdspecifies the ID of an existing status that the status to be posted is in reply to. 
 - 
                        
 - 
                
mentionsTimeline()returns the 20 most recent @replies (status updates prefixed with @username) for the authenticating user.Exemple 826. Showing user replies
$twitter = new Zend_Service_Twitter($options); $response = $twitter->statuses->mentionsTimeline();
The
mentionsTimeline()method accepts an array of optional parameters to modify the query.- 
                        
since_idnarrows the returned results to just those statuses after the specified identifier (up to 24 hours old). - 
                        
max_idnarrows the returned results to just those statuses earlier than the specified identifier. - 
                        
countspecifies the number of statuses to return, up to 200. - 
                        
trim_user, when set to boolean true, "t", or 1, will list the author identifier only in embedded user objects in the statuses returned. - 
                        
contributor_details, when set to boolean true, will return the screen name of any contributors to a status (instead of only the contributor identifier). - 
                        
include_entitiescontrols whether or not entities, which includes URLs, mentioned users, and hashtags, will be returned. 
 - 
                        
 - 
                
destroy()destroys the status specified by the requiredidparameter.Exemple 827. Deleting user status
$twitter = new Zend_Service_Twitter($options); $response = $twitter->statuses->destroy(12345);
 
- 
                
show()returns extended information of a given user, specified by ID or screen name as per the requiredidparameter below.Exemple 828. Showing user informations
$twitter = new Zend_Service_Twitter($options); $response = $twitter->users->show('myfriend');
 - 
                
search()will search for users matching the query provided.Exemple 829. Searching for users
$twitter = new Zend_Service_Twitter($options); $response = $twitter->users->search('Zend');
The
search()method accepts an array of optional parameters to modify the query.- 
                        
countspecifies the number of statuses to return, up to 20. - 
                        
pagespecifies the page of results to return, based on thecountprovided. - 
                        
include_entitiescontrols whether or not entities, which includes URLs, mentioned users, and hashtags, will be returned. 
 -