You are here: Fax API > Fax Web Service > Code Samples > PHP Samples > Retrieve the image of a submitted fax with GetFaxImageResult
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
Retrieve the image of a submitted fax with GetFaxImageResult
This sample demonstrates how to retrieve the fax image of a previously-submitted message
<?php /**************** Settings begin **************/ $username = ''; // Enter your Interfax username here $password = ''; // Enter your Interfax password here $transactionid = ''; // Enter the Transaction ID of the fax image to be retrieved /**************** Settings end ****************/ $client = new SoapClient("http://ws.interfax.net/dfs.asmx?wsdl"); $params->Username = $username; $params->Password = $password; $params->TransactionID = $transactionid; $params->Image = ''; $faxImage = $client->GetFaxImage($params); if ($faxImage->GetFaxImageResult == 0){ $filename = $transactionid . '.tif'; $content = $faxImage->Image; if (!$handle = fopen($filename, 'w')) { echo "Cannot open file ($filename)"; exit; } if (fwrite($handle, $content) === FALSE) { echo "Cannot write to file $filename"; exit; } fclose($handle); } else { // Problem with Web Service call // Do something } ?>