Cancel a pending fax with CancelFax

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 cancel a previously-submitted outbound fax.

Note that this will have effect only on faxes that are awaiting sending (i.e. status codes: -1 Preprocessing, -2 Ready, and some -3 Pending Retry) and not faxes that are actively being transmitted.


<?php

/**************** Settings begin **************/

$username  = '';   // Enter your Interfax username here
$password  = ''; // Enter your Interfax password here
$tx_id     = '';  // Transaction ID of the fax to be cancelled

/**************** Settings end ****************/

$client = new SoapClient("https://ws.interfax.net/dfs.asmx?WSDL");

$params->Username       = $username;
$params->Password       = $password;
$params->TransactionID  = $tx_id;

$result = $client->CancelFax($params);  // returns 0 if cancellation succeeded

if ($result->CancelFaxResult <> 0) echo 'Cancellation Error: ' . $result->CancelFaxResult . '';

?>