PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Status Methods

  • publicTimeline() 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.

    Example 866. Retrieving public timeline

    <?php
    $twitter 
    = new Zend_Service_Twitter(array(
        
    'username' => 'johndoe',
        
    'accessToken' => $token
    ));
    $response   $twitter->status->publicTimeline();

  • friendsTimeline() returns the 20 most recent statuses posted by the authenticating user and that user's friends.

    Example 867. Retrieving friends timeline

    <?php
    $twitter 
    = new Zend_Service_Twitter(array(
        
    'username' => 'johndoe',
        
    'accessToken' => $token
    ));
    $response   $twitter->status->friendsTimeline();

    The friendsTimeline() method accepts an array of optional parameters to modify the query.

    • since narrows the returned results to just those statuses created after the specified date/time (up to 24 hours old).

    • page specifies which page you want to return.

  • userTimeline() returns the 20 most recent statuses posted from the authenticating user.

    Example 868. Retrieving user timeline

    <?php
    $twitter 
    = new Zend_Service_Twitter(array(
        
    'username' => 'johndoe',
        
    'accessToken' => $token
    ));
    $response   $twitter->status->userTimeline();

    The userTimeline() method accepts an array of optional parameters to modify the query.

    • id specifies the ID or screen name of the user for whom to return the friends_timeline.

    • since narrows the returned results to just those statuses created after the specified date/time (up to 24 hours old).

    • page specifies which page you want to return.

    • count specifies the number of statuses to retrieve. May not be greater than 200.

  • show() returns a single status, specified by the id parameter below. The status' author will be returned inline.

    Example 869. Showing user status

    <?php
    $twitter 
    = new Zend_Service_Twitter(array(
        
    'username' => 'johndoe',
        
    'accessToken' => $token
    ));
    $response   $twitter->status->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.

    Example 870. Updating user status

    <?php
    $twitter 
    = new Zend_Service_Twitter(array(
        
    'username' => 'johndoe',
        
    'accessToken' => $token
    ));
    $response   $twitter->status->update('My Great Tweet');

    The update() method accepts a second additional parameter.

    • in_reply_to_status_id specifies the ID of an existing status that the status to be posted is in reply to.

  • replies() returns the 20 most recent @replies (status updates prefixed with @username) for the authenticating user.

    Example 871. Showing user replies

    <?php
    $twitter 
    = new Zend_Service_Twitter(array(
        
    'username' => 'johndoe',
        
    'accessToken' => $token
    ));
    $response   $twitter->status->replies();

    The replies() method accepts an array of optional parameters to modify the query.

    • since narrows the returned results to just those statuses created after the specified date/time (up to 24 hours old).

    • page specifies which page you want to return.

    • since_id returns only statuses with an ID greater than (that is, more recent than) the specified ID.

  • destroy() destroys the status specified by the required id parameter.

    Example 872. Deleting user status

    <?php
    $twitter 
    = new Zend_Service_Twitter(array(
        
    'username' => 'johndoe',
        
    'accessToken' => $token
    ));
    $response   $twitter->status->destroy(12345);

Zend Framework