ColdFusion Fax – Retrieve Outbound Fax Image

The GetFaxImage method, demonstrated in the snippet below, retrieves the image of an outbound (previously-submitted) fax with ColdFusion.

This ColdFusion fax example snippet retrieves an image of an outbound fax:


<cfoutput>

<!--- Username and password for the Interfax account. --->
<cfset interfaxUsername = "">
<cfset interfaxPassword = "">

<cfset transactionID     = "">
<cfset Image = ToBinary("")>

<!--- Create and call the web service --->
<cfset faxWebService = CreateObject("webservice", "https://ws.interfax.net/dfs.asmx?WSDL")>
<cfset getFaxImageResult = faxWebService.GetFaxImage(interfaxUsername, interfaxPassword, transactionID, "Image")>

<cfif getFaxImageResult eq 0>
    <cfset filename = ExpandPath(".") & "/" & transactionID & ".tif">
    <cffile action="write" file="#filename#" output="#Image#">
<cfelse>
    Error retrieving the image:  #getFaxImageResult#
</cfif>

</cfoutput>