Send a simple text fax using SendCharFax

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 the most basic submission of a simple text document for faxing.

Using HTML causes automatic word wrapping, whereas regular text does not.

This sample uses method SendCharFax.


<?php

/**************** Settings begin **************/
 
$username  = ''; // Enter your Interfax username here
$password  = ''; // Enter your Interfax password here
$faxnumber = ''; // Enter the destination fax number here in the format:
                 // +[country code][area code][fax number]
                 // for example: +12125554874
$texttofax = 'My text goes here'; // Enter your fax contents here
$filetype  = 'TXT'; // If $texttofax holds regular text, enter "TXT" here. 
                    // If $texttofax holds HTML enter "HTML" here
 
/**************** Settings end ****************/

$client = new SoapClient("http://ws.interfax.net/dfs.asmx?wsdl");

$params->Username  = $username;
$params->Password  = $password;
$params->FaxNumber = $faxnumber;
$params->Data      = $texttofax ;
$params->FileType  = $filetype;

$result = $client->SendCharFax($params);

echo $result->SendCharFaxResult; // Returns the submitted message's Transaction ID
                                 // or a negative number for failure
                                 // See http://www.interfax.net/en/dev/webservice/reference/web-service-return-codes

?>

Contact us today

Talk to a member of our team about the benefits InterFAX can bring to your organization's communications processes.

Contact us today