Retrieve the image of a previously-submitted outbound fax with GetFaxImage
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 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("https://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
}
?>