Retrieve a list of faxes sent for a specified period of time

POST Variables

 

Variable Name Type Var Type Description
action String Required Must be “Get_Fax_Outbox”
access_id Integer Required Account Number
access_pwd String Required Password on the user’s account
sResponseFormat String Optional “XML” or “JSON” – Default is JSON
sPeriod String Optional “ALL” or “RANGE” if not provided defaults to “ALL”
sStartDate String Optional Only required if “RANGE” is specified in sPeriod – date format must be “YYYYMMDD”
sEndDate String Optional Only required if “RANGE” is specified in sPeriod – date format must be “YYYYMMDD”
sIncludeSubUsers String Optional Set to “Y” if you want to include faxes received by a sub user of the account as well

 

Notes:

  • If you want to use sIncludeSubUsers, you will need to use the access_id and access_pwd of the Master Account

 

 

Returned Variables (JSON or XML Encoded)

 

Status string “Success” or “Failed”
Result string Array of the fax properties as follows:

Array[#]->array(
  FileName       => String(75), 
  SentStatus     => String(15), 
  DateQueued     => String,
  DateSent       => String,
  EpochTime      => String,
  ToFaxNumber    => String(20)
  Pages          => Integer, 
  Duration       => Integer, 
  RemoteID       => String(40), 
  ErrorCode      => String(75),
  AccountCode    => String(20),
  SenderEmail    => String(75),
  Subject        => String(128),
  Size           => Integer
  SubmittedFiles => String,
)

If sIncludeSubUsers is set to “Y” then two additional variables are returned in the array:

User_ID         => Integer
User_FaxNumber  => String(20)
Note: If an error is found then the reason for the failure will be in the Result string

 

Notes:

  • Both Date and Epoch Time are adjusted to your date/timezone settings
  • Epoch Time is a unix time stamp of the Date field
    • https://en.wikipedia.org/wiki/Unix_time
  • The error code will be a string describing the error encountered. There is a wide range of possible errors, the most frequent of which are “No Answer”, “Busy”, and “No Remote Fax”

 

 

Examples

PHP using cURL

  1. <?php
  2.    $postVariables = array(
  3.      ‘action’         => ‘Get_Fax_Outbox’,
  4.      ‘access_id’      => ‘12345’,
  5.      ‘access_pwd’     => ‘myPassword’,
  6.      ‘sPeriod’        => ‘RANGE’,
  7.      ‘sStartDate’     => ‘20150301’,
  8.      ‘sEndDate’       => ‘20150331’
  9.    );
  10.    $curlDefaults = array(
  11.        CURLOPT_POST           => 1,
  12.        CURLOPT_HEADER         => 0,
  13.        CURLOPT_URL            => “https://secure.srfax.com/SRF_SecWebSvc.php”,
  14.        CURLOPT_FRESH_CONNECT  => 1,
  15.        CURLOPT_RETURNTRANSFER => 1,
  16.        CURLOPT_FORBID_REUSE   => 1,
  17.        CURLOPT_TIMEOUT        => 60,
  18.        CURLOPT_SSL_VERIFYPEER => false,
  19.        CURLOPT_SSL_VERIFYHOST => 2,
  20.        CURLOPT_POSTFIELDS     => http_build_query($postVariables),
  21.    );
  22.    $ch = curl_init();
  23.    curl_setopt_array($ch, $curlDefaults);
  24.    $result = curl_exec($ch);
  25.    if (curl_errno($ch)) {
  26.        echo “Error – “ . curl_error($ch);
  27.    }
  28.    else {
  29.        echo “Result:” . print_r( json_decode($result, true), 1 );
  30.    }
  31. ?>

 

PHP using SRFax Object

  1. <?php
  2.   require_once (“srFax_class.php”);
  3.   $accountID        = “12345”;
  4.   $accountPassword  = “myPassword”;
  5.   // instantiate object with Account ID and Password
  6.   $srFax = new srFax ( $accountID, $accountPassword );
  7.   try {
  8.       $srFax->Get_Fax_Outbox(array(
  9.           ‘sPeriod’    => ‘RANGE’,
  10.           ‘sStartDate’ => ‘20150301’,
  11.           ‘sEndDate’   => ‘20150331’,
  12.       ));
  13.   }
  14.   catch (Exception $e) { //display error when exception is thrown
  15.       die(“Error: $e);
  16.   }
  17.   if ( $srFax->getRequestStatus () ) {
  18.       echo “Success! Response “ . print_r($srFax->getRequestResponse (), 1);
  19.   } else {
  20.       echo “ERROR: “ . $srFax->getRequestResponse ();
  21.   }
  22. ?>