Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 729
  • Last Modified:

WinFax 9.0 using PHP script

Could somebody provide sample of PHP script to send fax via winfax 9.0?
0
chwong67
Asked:
chwong67
  • 5
  • 5
1 Solution
 
Richard QuadlingSenior Software DeverloperCommented:
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
 
chwong67Author Commented:
Thanks for your information...
Could you please recomend the best practice to fax using PHP script?
0
 
Richard QuadlingSenior Software DeverloperCommented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
chwong67Author Commented:
We may consider using other faxing software.
We prefer send fax in PDF format.
Any suggestion?
0
 
Richard QuadlingSenior Software DeverloperCommented:
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
 
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:
http://www.experts-exchange.com/Programming/Languages/Scripting/Perl/Q_21102341.html?sfQueryTermInfo=1+10+30+winfax.sdksend

wfxsdk.pdf
0
 
Richard QuadlingSenior Software DeverloperCommented:
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
 
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 ...
0
 
Richard QuadlingSenior Software DeverloperCommented:
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
 
GetFaxingdotcomCommented:
There is a WinFax specific SDK forum here:
http://www.getfaxing.com/forums
0
 
chwong67Author Commented:
Thanks for your help.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now