问题
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?
回答1:
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
回答2:
PamFax provides a comprehensive PHP Fax API: http://www.pamfax.biz/en/developers/samples/
Disclaimer: I work for PamConsult, the company behind PamFax.
回答3:
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).
回答4:
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.
回答5:
I think you can do what you need with this script:
eFax PHP Fax API Script – Send Fax Using PHP
回答6:
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
回答7:
I've worked on something similar before only we were playing with drills through the serial port. It's not impossible.
You need:
- A local computer which acts as a the fax server
- A fax modem
- Phone line
- A command-line tool similar to sendfax
- PHP or any other scripting language installed on your fax server, to invoke the command line tool using
exec()
,shell_exec()
orsystem()
etc. - 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.
来源:https://stackoverflow.com/questions/2301810/can-i-send-a-fax-using-php