Solved

WinFax 9.0 using PHP script

Posted on 2010-09-01
11
708 Views
Last Modified: 2012-05-10
Could somebody provide sample of PHP script to send fax via winfax 9.0?
0
Comment
Question by:chwong67
  • 5
  • 5
11 Comments
 
LVL 40

Expert Comment

by:RQuadling
ID: 33581931
According to http://en.wikipedia.org/wiki/WinFax, 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. http://www.winfax.com/ threw me for a sec as it was talking about GFI ... Naughty domain name grab!
0
 
LVL 9

Author Comment

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

Expert Comment

by:RQuadling
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 ...

@@Fax:01234393399
@@Cover:FaxCover1.png
@@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.


@@Fax:01234393399
@@Template:InvoiceTemplate.tmpl
@@Invoice:Number:1234
@@Invoice:Customer:Richard Quadling
etc.

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.

0
 
LVL 9

Author Comment

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

Expert Comment

by:RQuadling
ID: 33582873
For creating a PDF in PHP, I use fpdf (http://www.fpdf.org). 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?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 9

Author Comment

by:chwong67
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:
http://www.experts-exchange.com/Programming/Languages/Scripting/Perl/Q_21102341.html?sfQueryTermInfo=1+10+30+winfax.sdksend

wfxsdk.pdf
0
 
LVL 40

Expert Comment

by:RQuadling
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 http://docs.php.net/manual/en/book.com.php 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.
<?php
// 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.
com_load_typelib('CrystalDesignRunTime.Application');

// 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.
$o_CrReport->Database->LogOnServer
	(
	'odbc',
	'CCC',
	registryDatabaseLocations_V2::Database(registryDatabaseLocations_V2::REG_CONN_CCCSQL),
	registryDatabaseLocations_V2::Username(registryDatabaseLocations_V2::REG_CONN_CCCSQL),
	registryDatabaseLocations_V2::Password(registryDatabaseLocations_V2::REG_CONN_CCCSQL)
	);

// 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->ReadRecords();
$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
$o_CrReport->Export(False);

?>

Open in new window

0
 
LVL 9

Author Comment

by:chwong67
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 ...
0
 
LVL 40

Accepted Solution

by:
RQuadling earned 500 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.
0
 
LVL 3

Expert Comment

by:GetFaxingdotcom
ID: 33741155
There is a WinFax specific SDK forum here:
http://www.getfaxing.com/forums
0
 
LVL 9

Author Closing Comment

by:chwong67
ID: 33882579
Thanks for your help.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now