How to Integrate InterFAX's Inbound and Outbound fax facility in PHP

8 posts / 0 new
Last post
#1 Mon, 27 Jun 2005 09:43

How to Integrate InterFAX's Inbound and Outbound fax facility in PHP

One of our client have an account with your site having the username as “crackiswack” and want to integrate your Inbound as well as Outbound fax facility in our site that is built in PHP.

We got a sample code from your site to send fax which is as follows,

* Send a Fax using PHP/PEAR::SOAP Example:
* - Using SendFaxEx() Method from InterFax Web Services

* Your variables go here - assign a value to each one
$username = "crackiswack";
$password = ""; // password I am not mentioning here
$faxnumber = "+0018003100021";  // formatted like +13055551234, i.e. +(country code)(area code)(phone number)
$file = "documents/doc10.doc"; // binary file to fax
$filetype = "DOC"; //e.g. HTML, DOC, PDF, etc.; see documentation for complete list
$postponetime = "2005-04-25T20:31:00-04:00";  //e.g. 2001-04-25T20:31:00-04:00, use a past date/time to fax immediately
$resolution = "0"; // 0 for standard, 1 for fine
$csid = ""; // your fax identifier, visible on the receiving machine's little screen
$subject = "fax from Webintegrated"; // for your reference, visible in the outbound queue
$replyemail = ""; //optional address at which to receive an emailed confirmation

* PEAR::SOAP class []
require_once 'SOAP/Client.php'; 

// Open File
if( !($fp = fopen($file, "r")))
// Error opening file
// Handle error how it is appropriate for your script

// Read data from the file into $data
$data = "";
while (!feof($fp)) $data .= fread($fp,1024);

// URL path to InterFax Web Services
$wsdl_url = '';

// Create an instance of the SOAP_WSDL class
$WSDL = new SOAP_WSDL($wsdl_url); 

* This function creates a proxy to the SOAP services
* so that you can access the InterFax methods directly
* as if you were calling a local function
$client = $WSDL->getProxy(); 

* Invoke the InterFax SendFaxEx Method
* NOTE: 'base64_encode' is a native method in PHP []
$result = $client->SendFaxEx($username, $password, $faxnumber, base64_encode($data), $filetype, strlen($data), $postponetime, $resolution, $csid, $subject, $replyemail); 

// Echo Result
if($result > 0) echo "Fax submitted. Transaction ID: $result";
else echo "Error sending fax. Return code: $result";

According to the above code, we need SOAP/client.php file. We have downloaded the complete SOAP package from the given URL ( but this does not contain some files like PEAR.php, HTTP/Request.php etc. (for which it has shown us the errors while running it.)

Please let us know whether we are on right way or not?

Web Integrated (India)

Mon, 27 Jun 2005 10:44
Adam M

Yes, you are absolutely on the right way.

The first thing, however, is to verify that your SOAP installation is complete. All of PEAR::SOAP's dependencies can be found on the PEAR website. (These are the files that we use internally. I'm not sure if these are the most up-to-date, but they do work on our installation)

Alternatively, for a SOAP installation with no dependencies, you can try the NuSOAP library. See the discussion related to sending a fax through NuSOAP.

Mon, 27 Jun 2005 11:30

Thanks for ur reply.

But let me tell u that i am using apache 2.0 on windows 2000 professional for the develoment of the site.

So can u tell me what steps should i follow to install SOAP on my machine.

Currently, what i did, i created a folder in my apache's root directory with the name "test" and copid all the folders HTTP,NET,SOAP in it. Written the above code in test.php file. But while runnig it, getting errors of missing few files. This time the error is

Warning: main(Net/Socket.php): failed to open stream: No such file or directory in C:\Apache\Apache2\htdocs\AJ\HTTP\Request.php on line 47

Please help me out.


Mon, 27 Jun 2005 12:23
Adam M

Installing SOAP simply means copying the files to a location where you can reference them from within your script. So, if you have downloaded the bare minimum SOAP files for InterFAX, all you need to do is to update your include path and to include SOAP:

ini_set("include_path",'/path/to/inc' . ':' . ini_get("include_path"));
require_once 'SOAP/Client.php';
Mon, 27 Jun 2005 14:04

Please can u come over yahoo or hotmail or aol IM. We will be there as webintegrated.

Wed, 29 Jun 2005 15:49

Does thsi work for you ? i have same problem i did all what you asked still give error .. can any one help me pls ..


Wed, 29 Jun 2005 16:02
Adam M


webintegrated seemed to have a problem with his PEAR::SOAP installation. Instead of debugging it, I suggested that he install NuSOAP, using a trivial faxing example, and he had it running within minutes.

Simply download the latest version of NuSOAP and use this code:


$client = new soapclient("", true);
$params[] = array('Username'        => '9999999',
                'Password'        => 'abcdefg',
                'FaxNumber'        => '+44-870-730-1444',
                'Data'            => 'My text goes here',
                'FileType'        => 'TXT'

$result = $client->call("SendCharFax", $params);

echo $result["SendCharFaxResult"];

Mon, 25 Jul 2005 23:33

Like Adam said you not only need to have the PEAR SOAP classes but all the base PEAR classes as well. A lot of web host provide the base classes in a shared directory that all web host clients can access, but you can always download all of them yourself and put in an "include" folder within your web hosting directory.

I know its been about a month since the last post so let me know if you were able to figure it out or not.

Log in or register to post comments

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