Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the '10.3: Fax from command line (or AppleScript)' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.3: Fax from command line (or AppleScript)
Authored by: bugugly on Mar 10, '05 02:44:53PM
Great stuff. Used your info and some php to create a www fax server that requires only a web browser to send faxes from our central server machine.

//make a file for testing, real world just pass in the filename
//and run from efix creation on down
$filename = date("ymdHis");
//create a file with no extension, extensions are hard to work with in efix
if ($newfile = fopen(FAX_FILE_LOCATION.$filename,"x"))//x for new file, fails if file exists
	fwrite($newfile,"Making faxes baby!  From your friendly neighborhood WWW fax server! \n \n $filename");
	print("Could not create file, check permissions or file already exists");

/**********Now efix to create a tiff G3 doc***********/
/**********see man efix for details******************/

$do_efix = exec("efix -n".FAX_FILE_LOCATION.$filename.".%03d ".FAX_FILE_LOCATION.$filename, $output, $returnValue);

if ($returnValue == 0)
  $faxnum = '5555555555';
  /**Not sure if I need a wait state in here before setting up the fax**/
  print("<br>Fax starts in 5 seconds.....<br>");
  sleep(5);//just in case, give efix a little time
  //thanks to for lp -d -o stuff
  $dofax = exec("lp -d Internal_Modem -o phone=$faxnum ".FAX_FILE_LOCATION.$filename.".001",$output, $returnValue);
  //view results for debugging
  print("<br><hr>WWW fax server results: <br>\n");
  foreach ($output as $line)
  if ($returnValue== 0) {
  	print("<br>If you see a request ID your fax was successfully submitted with the job name listed under result. \n");
  	print("<br>Administrators can view this job from WWW by viewing CUPS print queue.");
    else print("<br>Error submitting fax job, make note of results listed above");


[ Reply to This | # ]