If I understood well, you want to use php on command-line.
In this case, php uses the $argv array to store them.
$argv[0] is the name of the script.
For example you want to launch print.php :
>> ./php print.php myUser myText
$argv[0] holds print.php
$argv[1] holds myUser
$argv[2] holds myText
Now the problem is that you'll certainly have some blank spaces as myText...
Try this code :
==================
<?php
$myScript = array_shift($argv); //Get scriptname and remove from array
$myUser = array_shift($argv); //Get username and remove from array
$myText = implode(' ', $argv); //Gets all the other arguments and puts it as text
// Eventually, you'll have to replace carriage returns.
// Say you set \n
$myText = str_replace('\n', "\n", $myText");
$myTextHeader = "printed by : $myUser on ".date("F j, Y, g:i a")."\n";
//your code
$handle=printer_open("\\ne
printer_write($handle,$myT
printer_close($handle);
?>
Hope it works, I don't have a printer :P
Main Topics
Browse All Topics





by: VGRPosted on 2003-04-02 at 08:39:45ID: 8254717
no, you can't send a FORM, but you could send an HTML file being a form. Note that it would display as text (HTML source) AFAIK