9

I have fax numbers and I would like to send a fax message to each of the numbers programatically.

What is the code to send fax message using PHP?

Toby Speight
  • 27,591
  • 48
  • 66
  • 103
Sushant Panigrahi
  • 195
  • 3
  • 5
  • 10
  • 3
    Using a Fax service is always connected with cost, and setting up an account with a gateway provider. Are you prepared for that? Where are you located? What countries do you want to send faxes to? – Pekka Feb 20 '10 at 10:23

7 Answers7

5

As fax is not internet-based like email, there is no easy way to do this, like you can send emails using mail().

You can, though, use PHP to talk to an internet fax service, as described here: http://www.interfax.net/en/dev/php

Douwe Maan
  • 6,888
  • 2
  • 34
  • 35
4

PamFax provides a comprehensive PHP Fax API: http://www.pamfax.biz/en/developers/samples/

Disclaimer: I work for PamConsult, the company behind PamFax.

j0k
  • 22,600
  • 28
  • 79
  • 90
2

To expand on Douwe Maan's answer, using Interfax's PHP fax sample code will get you faxing with just the following code on your end:

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

$params->Username  = $username;
$params->Password  = $password;
$params->FaxNumber = $faxnumber;
$params->Data      = 'Hello World';
$params->FileType  = 'TXT';

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

You can loop over this multiple times to send multiple faxes. Or if you need to send a single fax to multiple recipients you could use the SendfaxEx_2 method which accepts multiple recipient fax numbers (documentation, PHP sample).

Adam M
  • 136
  • 6
  • Please note, you are supposed to mention in the posts that you're associated with Interfax, it's not enough to just mention it in your profile. – Hans Olsson Nov 30 '11 at 15:35
  • note that the interfax ssl cert is not up for renewal until november of 2018 - they have one of the symantec, geotrust, thawte and rapidssl certificates that were compromised. they refuse to update it stating that even though chrome and firefox will not accept the certs IE does. – WEBjuju Jun 11 '18 at 18:37
1

You could interface with Hylafax and let it do the actual job.

An example of successful implementation is AvantFAX. It's open source, so you can look at the code and see how they did it.

Milan Babuškov
  • 59,775
  • 49
  • 126
  • 179
0

Hoiio provides a simple RESTful API to send a fax. http://developer.hoiio.com/docs/fax_send.html

You can also receive fax all the same. The charges are by "per minute", since fax are nothing but transmitted data over a phone call.

Disclaimer: I work for Hoiio

samwize
  • 25,675
  • 15
  • 141
  • 186
0

I've worked on something similar before only we were playing with drills through the serial port. It's not impossible.

You need:

  1. A local computer which acts as a the fax server
  2. A fax modem
  3. Phone line
  4. A command-line tool similar to sendfax
  5. PHP or any other scripting language installed on your fax server, to invoke the command line tool using exec(), shell_exec() or system() etc.
  6. Cron / Scheduled Tasks

The whole idea is to store your faxes on the webserver, and have your fax server poll your webserver, download the faxes and send them at regular intervals. Of course, you also need to configure some sort of syncing mechanism between the servers to make sure your faxes don't get sent twice.

Silviu-Marian
  • 10,565
  • 6
  • 50
  • 72
0

I think you can do what you need with this script:

eFax PHP Fax API Script – Send Fax Using PHP

Paul
  • 87
  • 1
  • 2
  • 12
  • 1
    Link is 404. Found a link to code that sends efax with php. http://freecode.com/projects/phpefax – Mark Feb 18 '14 at 19:03