You are here: Fax API > Fax Web Service > Code Samples > PHP Samples > Send a simple ASCII-text fax using SendCharFax
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
Send a simple ASCII-text fax using SendCharFax
This sample demonstrates the most basic submission of a simple text document for faxing. Text is limited to be standard ASCII (no 8-bit characters), but may include HTML markup. 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 (ASCII text only) $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 ?>