<?php

require_once 'plivo.php';
$auth_id = "Your AUTH_ID";
$auth_token = "Your AUTH_TOKEN";
$p = new RestAPI($auth_id, $auth_token);
// Fetch the details
$response = $p->get_messages();
// Print the response
print_r($response['response']);
// Filter the response
$params = array('limit' => '2', 'offset' => '0', 'message_direction ' => 'outbound', 'message_state' => 'sent', 'subaccount' => 'SubAccount_AUTH_ID');
// Fetch the details
$response = $p->get_messages($params);
// Print the response
print_r($response['response']);
?>

<!--
Sample Output without Filters
(
    [api_id] => f9adfd4a-a264-11e4-a2d1-22000ac5040c 
    [meta] => Array ( 
        [limit] => 2 
        [next] => /v1/Account/XXXXXXXXXXXXXXX/Message/?message_state=sent&limit=2&offset=2&message_direction+=outbound 
        [offset] => 0 
        [previous] => 
        [total_count] => 70 
    ) [objects] => Array ( 
        [0] => Array ( 
            [from_number] => 1111111111