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
}
?>