WinFax 9.0 using PHP script

Could somebody provide sample of PHP script to send fax via winfax 9.0?
Who is Participating?
Richard QuadlingSenior Software DeveloperCommented:
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.
Richard QuadlingSenior Software DeveloperCommented:
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!
chwong67Author Commented:
Thanks for your information...
Could you please recomend the best practice to fax using PHP script?
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Richard QuadlingSenior Software DeveloperCommented:
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.

chwong67Author Commented:
We may consider using other faxing software.
We prefer send fax in PDF format.
Any suggestion?
Richard QuadlingSenior Software DeveloperCommented:
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?
chwong67Author Commented:
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:

Richard QuadlingSenior Software DeveloperCommented:
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

chwong67Author Commented:
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 ...
There is a WinFax specific SDK forum here:
chwong67Author Commented:
Thanks for your help.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.