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

Direct Message Methods

  • messages() returns a list of the 20 most recent direct messages sent to the authenticating user.

    Example 876. Retrieving recent direct messages received

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

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

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

    • 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.

  • sent() returns a list of the 20 most recent direct messages sent by the authenticating user.

    Example 877. Retrieving recent direct messages sent

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

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

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

    • 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.

  • new() sends a new direct message to the specified user from the authenticating user. Requires both the user and text parameters below.

    Example 878. Sending direct message

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

  • destroy() destroys the direct message specified in the required id parameter. The authenticating user must be the recipient of the specified direct message.

    Example 879. Deleting direct message

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

Zend Framework