Cancel a pending fax with CancelFax

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("http://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: <a href="http://www.interfax.net/en/dev/webservice/reference/web-service-return-codes">' . $result->CancelFaxResult . '</a>';
 
?>