Sending fax with PHP?

i don’t know if i am just deaming or is it really possible.

what i want to do is, that somebody have some text they paste it into a text box and click send and the fax is sent to somebody via internet

is it possible?

Thanks for the link, mancroft. nice code there to use
But, it looks like my host doesn’t have pear/SOAP installed (where i am testing it), so can’t really use that code
any more, suggestions are more than welcome

I think InterFax may be one of the only methods of doing this. I looked around but could only find reference’s to interfax ( )

thanks mark.

one more question. i saw Interfax using SOAP. how does that work. any ideas. i am just looking for general information about how the fax works online.


May not be the best solution but I found this site when I was looking for sending Faxes on the fly:

You basically send an email to their server and it sends it out as a fax. Like will send a fax to that fax number. I’m not sure how much it is to sign up.


what i want to know is, the theoratical knowledge of how to send fax with PHP and if possible some examples

i appreciate your responses.

Sending faxes from PHP is a bit tricky. Mainly because sending faxes requires some interaction with hardware as well as transforming the output into something a fax server can send.

I would really look at doing it through a service rather than doing it yourself. Another option would be to pick up a dedicated fax server (we use Zetafax) which can listen to an email account and handle things that way.

or pick up a used faxpress box from ebay. you can e-mail a TIFF (or with newer versions PDF) to the faxpress box, and it will send the fax.

you can also just drop TIFF images in a specific directory on your server, and the faxpress box will see themand send the fax. that’s even easier than the e-mail solution.

God. Faxpress. I have not dealt with one of those in a long time. It still makes me feel all icky.

I would like to point out that email is alot easier to generate from php than TIFFs or PDFs.

there’d be not much generation of pdfs. the point is how to send fax from PHP. and looking at the reponses i see its quite difficult (if not impossible). i’ll keep an eye open for other suggestions or scripts, but for the time being i see no hope for this

SOAP is a protocol which allows code to interact with other code over a network at data level. It is based on XML. So for instance it allows for transferring data structures, along with their types. One can effectively do a remote function call over a network by submitting, and then receiving a response.

It may be the case that there already exists a PHP library for connecting with Interfax and sending faxes. If not, you may be able to use a third-party SOAP library that does not require PEAR.

This probably won’t be that useful to you specifically, but for the general case:

If you’re running PHP on a *nix box with a fax/modem, a phone line, and can install a copy of Hylafax (free)… this should do the trick for simple text:

// Create a temp file to store the message in
$tmpfname = tempnam ("/tmp", "FOO");

$fp = fopen($tmpfname, "w");
fwrite($fp, $this->message);

// Call Sendfax:
// Note the "0,," hack to get an outside line
$command = "/usr/local/bin/sendfax -n -d \\"0,,".$phone_number."\\" -f \\"From Name, Number\\" $tmpfname";



You did specify that you wanted to send using the Internet. In that case you will require the use of an online fax provider or setup your own infrastructure. The former being much simpler and cheaper.

Some online fax providers will let you send a fax using email. Usually you just address the email to and enter some text to send in the body of the email.

That is by far the simplest way to send a fax from PHP. As it is as easy as using the mail function. Any other way is going to require SOAP, XMLRPC or posting to an (often complex) HTTP(s) interface.

Checkout for a list of providers. Then just pick one that does email2fax.

If you want to invest money in your own infrastructure then Hylafax can be as a fax server and I believe there are some classes out there for PHP that can submit a fax.

You should be able to install PEAR in a subdirectory in your space. I believe.

Thanks, everybody
first i thought i was trying to do impossible.

well, i checked my host and they installed soap. i am going to try the script by interfax(which actually uses there soap server, i assume).

while i liked the oter sugestions about having our own server, but i think that’d be too much in our case.

but again, thanks everybody for clarifying this matter to me.

if you think there is something i am missing, please mentio it here for me.


In my opinion, thats a bad idea. You’re giving people the option of wasting all of your toner and paper by sending random faxes. It’s like setting up a mail-sender on your site where you can input the number to send. Some people will use it against you.

Just my two cents.

i am not the one who is providing this service. its interfax. i was just testing it. and if it works i can use it to send faxes to my clients (which i need for some reason) and it’ll also save me some money for sending faxes.

Oh, I see. So you are sending the faxes? Sorry, I thought people could send faxes to you such as a form mailer sends emails to you.

Faxes don’t have to be printed. Actually a lot of people and businesses use a computer program for faxes such as Lightning Fax where all your faxes arrive at your computer instead of arriving at an external fax machine. You can print only the ones you need.

That was just ‘my two cents’ regarding faxes

Julie :slight_smile: