Get information about one or more submitted faxes with FaxStatusEx

25 Nov 2016 This code sample is deprecated and in process of being removed. Check out our new code libraries and usage documentation on InterFAX @ Github.

This sample demonstrates how to retrieve information about a sent fax using the FaxStatusEx method.


<?php
 
/**************** Settings begin **************/
 
$username    = '';    // Enter your Interfax username here
$password    = ''; // Enter your Interfax password here
$last_txid   = '999999999';  // Enter the transaction ID for which data
                             // is to be retrieved, or "999999999" for 
                             // the most recent transaction(s)
$max_items   = '10';   // How many transactions to return information for
 
/**************** Settings end ****************/
 
if($last_txid != '999999999') $last_txid++;  // LastTransaction ID needs to be one higher
                                             // than the transaction be queried for
 
// Retrieve information from InterFAX
 
$client = new SoapClient('https://ws.interfax.net/dfs.asmx?wsdl');
 
$params->Username          = $username;
$params->Password          = $password;
$params->LastTransactionID = $last_txid;
$params->MaxItems          = $max_items;
$params->TotalCount        = '';
$params->ListSize          = '';
$params->ResultCode        = '';
 
$queryResult = $client->FaxStatusEx($params);
 
// print_r($queryResult);
 
// Format information retrieved from InterFAX
 
if (0 == $queryResult->ResultCode){ // status request succeeded
    switch($queryResult->ListSize){
        case 0:
            echo 'No transactions fit query';
            break;
 
        case 1: // single item returned by WS call
            echo 'ParentTransactionID: ' . $queryResult->FaxStatusExResult->FaxItemEx->ParentTransactionID . '';
            echo 'TransactionID: ' . $queryResult->FaxStatusExResult->FaxItemEx->TransactionID . '';
            echo 'SubmitTime: ' . $queryResult->FaxStatusExResult->FaxItemEx->SubmitTime . '';
            echo 'CompletionTime: ' . $queryResult->FaxStatusExResult->FaxItemEx->PostponeTime . '';
            echo 'CompletionTime: ' . $queryResult->FaxStatusExResult->FaxItemEx->CompletionTime . '';
            echo 'UserID: ' . $queryResult->FaxStatusExResult->FaxItemEx->UserID . '';
            echo 'Contact: ' . $queryResult->FaxStatusExResult->FaxItemEx->Contact . '';
            echo 'DestinationFax: ' . $queryResult->FaxStatusExResult->FaxItemEx->DestinationFax . '';
            echo 'ReplyEmail: ' . $queryResult->FaxStatusExResult->FaxItemEx->ReplyEmail . '';
            echo 'RemoteCSID: ' . $queryResult->FaxStatusExResult->FaxItemEx->RemoteCSID . '';
            echo 'PagesSent: ' . $queryResult->FaxStatusExResult->FaxItemEx->PagesSent . '';
            echo 'Status: ' . $queryResult->FaxStatusExResult->FaxItemEx->Status . '';
            echo 'Duration: ' . $queryResult->FaxStatusExResult->FaxItemEx->Duration . '';
            echo 'Subject: ' . $queryResult->FaxStatusExResult->FaxItemEx->Subject . '';
            echo 'PagesSubmitted: ' . $queryResult->FaxStatusExResult->FaxItemEx->PagesSubmitted . '';
            echo 'SenderCSID: ' . $queryResult->FaxStatusExResult->FaxItemEx->SenderCSID . '';
            echo 'Priority: ' . $queryResult->FaxStatusExResult->FaxItemEx->Priority . '';
            echo 'Units: ' . $queryResult->FaxStatusExResult->FaxItemEx->Units . '';
            echo 'CostPerUnit: ' . $queryResult->FaxStatusExResult->FaxItemEx->CostPerUnit . '';
            echo 'PageSize: ' . $queryResult->FaxStatusExResult->FaxItemEx->PageSize . '';
            echo 'PageOrientation: ' . $queryResult->FaxStatusExResult->FaxItemEx->PageOrientation . '';
            echo 'PageResolution: ' . $queryResult->FaxStatusExResult->FaxItemEx->PageResolution . '';
            echo 'RenderingQuality: ' . $queryResult->FaxStatusExResult->FaxItemEx->RenderingQuality . '';
            echo 'PageHeader: ' . $queryResult->FaxStatusExResult->FaxItemEx->PageHeader . '';
            echo 'RetriesToPerform: ' . $queryResult->FaxStatusExResult->FaxItemEx->RetriesToPerform . '';
            echo 'TrialsPerformed: ' . $queryResult->FaxStatusExResult->FaxItemEx->TrialsPerformed . '';
            break;
 
        default: // multiple items returned by WS call
            for($i = 0; $i < $queryResult->ListSize; $i++){
                echo 'ParentTransactionID: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->ParentTransactionID . '';
                echo 'TransactionID: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->TransactionID . '';
                echo 'SubmitTime: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->SubmitTime . '';
                echo 'CompletionTime: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->PostponeTime . '';
                echo 'CompletionTime: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->CompletionTime . '';
                echo 'UserID: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->UserID . '';
                echo 'Contact: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->Contact . '';
                echo 'DestinationFax: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->DestinationFax . '';
                echo 'ReplyEmail: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->ReplyEmail . '';
                echo 'RemoteCSID: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->RemoteCSID . '';
                echo 'PagesSent: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->PagesSent . '';
                echo 'Status: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->Status . '';
                echo 'Duration: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->Duration . '';
                echo 'Subject: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->Subject . '';
                echo 'PagesSubmitted: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->PagesSubmitted . '';
                echo 'SenderCSID: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->SenderCSID . '';
                echo 'Priority: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->Priority . '';
                echo 'Units: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->Units . '';
                echo 'CostPerUnit: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->CostPerUnit . '';
                echo 'PageSize: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->PageSize . '';
                echo 'PageOrientation: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->PageOrientation . '';
                echo 'PageResolution: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->PageResolution . '';
                echo 'RenderingQuality: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->RenderingQuality . '';
                echo 'PageHeader: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->PageHeader . '';
                echo 'RetriesToPerform: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->RetriesToPerform . '';
                echo 'TrialsPerformed: ' . $queryResult->FaxStatusExResult->FaxItemEx[$i]->TrialsPerformed . '';
                echo '------------------------------------';
            }  // close loop
                break;
        }  // close switch
} else { // problem getting status
    // Do something here, like alerting an administrator
    echo 'Problem retrieving status';
}
 
?>

Contact us today

Talk to a member of our team about the benefits InterFAX can bring to your organization's communications processes.

Contact us today