Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


WinFax 9.0 using PHP script

Posted on 2010-09-01
Medium Priority
Last Modified: 2012-05-10
Could somebody provide sample of PHP script to send fax via winfax 9.0?
Question by:chwong67
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
LVL 40

Expert Comment

by:Richard Quadling
ID: 33581931
According to, WinFax 9 is 12 years old. Are you sure this is what you are using?

In the past, I've used PHP to create a plain text file (with special entries to include cover sheet, fax number, layout images, etc.) and drop it into a directory for GFI FaxMaker to send. I've done the same sort of thing with ToBIT FaxWare (and later David).

No direct communication needed. Extremely simple technique and capable of being handled by even an MSDOS Batch file!

I can't find a manual online as the product was discontinued by Symantec in 2005 (Wikipedia).

But if you do have a manual (or help file), look for entries like "file transfer" or "file monitoring" or "directory monitor", etc.

OOI. threw me for a sec as it was talking about GFI ... Naughty domain name grab!

Author Comment

ID: 33582817
Thanks for your information...
Could you please recomend the best practice to fax using PHP script?
LVL 40

Expert Comment

by:Richard Quadling
ID: 33582841
It depends upon the capabilities of the faxing software.

If you can provide some documentation for WinFaxPro, then I can advise you on what it can do.

These things tend to be pretty simple.

You create a text file with entries like ...

@@Sheet:Sheet1.png Sheet2.png
And here is the first line of the fax message.

Some are more complex in that you can send the data to a template.

@@Invoice:Customer:Richard Quadling

The template would sort out all the work.

This is the simplest way to work.

More complex would be to see if the faxing software has an COM server. PHP supports COM (nearly perfectly).

I use PHP+COM to talk to Crystal Reports and MS Word.

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 33582855
We may consider using other faxing software.
We prefer send fax in PDF format.
Any suggestion?
LVL 40

Expert Comment

by:Richard Quadling
ID: 33582873
For creating a PDF in PHP, I use fpdf ( This is a free class with a lot of tutorials on creating PDF files.

Once you've got your PDF, you are going to need to send it to something. A fax server.

And as I keep saying, I can't find any documentation on WinFax, so I can't get any further.

Do you have a manual for WinFax?

Author Comment

ID: 33594257
Thanks for your help...
I attched the manual for your reference and i am new to PHP...
I found the following link which is quite related to this issue:

LVL 40

Expert Comment

by:Richard Quadling
ID: 33594746
On page 1-1 of the PDF, you'll see that WinFax PRO SDK uses a Component Object Model interface.

This is good.

This, to a point, means you can talk to WinFax Pro from PHP using PHP's built in COM interface.

It means you should have total control over the content of the fax, the layout, how it is sent, cover page, logging, etc. Everything documented in the PDF link you provided.

You are going to have to learn 2 significant technologies. PHP's OOP/COM and WinFaxPro COM objects.

So, start with and the PDF.

Please remember that you are using a third party tool (WinFaxPro) and controlling it using PHP (via the COM interface). As such the WFP documentation is all you have to go on to make faxes, etc.

I (and others here), can certainly help you get going and help along the way. But without the SDK, we can't test any code. I do not use WinFax Pro and I have no intention of installing the SDK.

So. Read up on COM and WFP's code. Look at some of the examples of talking to Word or Excel (from the various user notes in the PHP manual on the COM section) and then start adapting the code to talk to WFP.

I've attached a small script that I use to talk to Crystal Reports as an example of PHP+COM.

The code has been heavily edited. The important thing to notice is that once I've created the COM instance, I talk to it like a normal object.

Unfortunately, you will need to fully understand the other app to make use of it. It is NOT PHP's job to know what to do.
// Create an Crystal Object Factory.
$o_CrObjectFactory = New COM('CrystalReports11.ObjectFactory.1');

// Create the Crystal Reports Runtime Application.
$o_CrApplication = $o_CrObjectFactory->CreateObject("CrystalRunTime.Application.11");

// Register the typelibrary.

// Where is the real filename?
$s_RptFilename = realpath("../CrystalReports/Collection Ticket.rpt");

// Load the report.
$o_CrReport = $o_CrApplication->OpenReport($s_RptFilename, 1); // 1 == crOpenReportByTempCopy.

// Logon to the database.

// Don't tell anyone what is going on when running live.
$o_CrReport->DisplayProgressDialog = is_dev();

// Define the params to be supplied.
$a_ParametersToSupply = array
	'{?Collection Ticket Number}' => $s_Ticket,

$s_PDF = realpath("../Work Files") . DIRECTORY_SEPARATOR . 'Collection Ticket #' . md5($s_Ticket) . '.pdf';

// Iterate the parameters and set them to the required values shown above.
foreach($o_CrReport->ParameterFields as $i_Parameter => $o_Parameter)
	$o_Parameter->SetCurrentValue($a_ParametersToSupply[$o_Parameter->Name], $o_Parameter->ValueType);

// Run the report and save the PDF to disk.
$o_CrReport->ExportOptions->DiskFileName = $s_PDF;
$o_CrReport->ExportOptions->PDFExportAllPages = True;
$o_CrReport->ExportOptions->DestinationType = 1; // Export to File
$o_CrReport->ExportOptions->FormatType = 31; // Type: PDF


Open in new window


Author Comment

ID: 33601639
Thank you very much  for your valuable information...
My requirement is very simple,
I manage to save the report to pdf format (using fpdf), next i need to know how to send this pdf file to winfax with fax number provided ...
LVL 40

Accepted Solution

Richard Quadling earned 1500 total points
ID: 33602419
Do you know if the COM library is installed?

Using a type lib viewer you can examine the library (google for this, there are simply loads!).

I've not got the library, so I don't know the exact mechanism, but you've got the documentation.

So give it a go and I can help with ideas on what you need to change.

Expert Comment

ID: 33741155
There is a WinFax specific SDK forum here:

Author Closing Comment

ID: 33882579
Thanks for your help.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question