I have a function to do raw printing like this:
function execPrint($pPrinterShareName, $pInit, $pData)
{
$tmpdir = sys_get_temp_dir(); # temporary directory to save temporary file
$x = 0;
$file = tempnam($tmpdir, 'cetak_struk__'.$pInit.'_'.$x); # temporary file name that will be printed
$handle = fopen($file, 'w');
fwrite($handle, $pData);
fclose($handle);
sleep(1);
chmod($file, 0777);
$v='';
$v = copy($file, "//localhost/".$pPrinterShareName);
sleep(1);
return $v;
}
this function will create a temporary folder and put a temporary file there. Then the file will be printed by copying that file to my localhost printer. $pPrinter
I can do this if my application is in my localhost, but how can I do that if my application is in an online hosting? Please help...