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?
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?
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
PamFax provides a comprehensive PHP Fax API: http://www.pamfax.biz/en/developers/samples/
Disclaimer: I work for PamConsult, the company behind PamFax.
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).
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.
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
I've worked on something similar before only we were playing with drills through the serial port. It's not impossible.
You need:
exec()
, shell_exec()
or system()
etc.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.
I think you can do what you need with this script: