You are here: Fax API > Fax Web Service > Code Samples > PHP Samples > Cancel a pending fax with CancelFax
PHP Faxing Samples
- Tutorial: Fax from PHP
- Send a simple ASCII-text fax using SendCharFax
- Send one file attachment (e.g., PDF, DOC, HTML) to one recipient with Sendfax
- Fax one or more files to one or more recipients with SendfaxEx_2
- Get information about one or more submitted faxes with FaxStatusEx
- Get information about one or more submitted faxes with FaxQuery
- Get information about one or more submitted faxes with FaxQuery2
- Retrieve the image of a submitted fax with GetFaxImageResult
- Cancel a pending fax with CancelFax
- Inbound: get list of inbound faxes using GetList
- Inbound: retrieve a received fax using GetImageChunk
- Deprecated Samples
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>'; ?>