note 33032 added to function.printer-list
| From: | saidyjade at hotmail dot com | Date: | Sat, 14 Jun 2003 16:52:40 +0000 |
| Subject: | note 33032 added to function.printer-list | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-50343@lists.php.net to get a copy of this message | ||
You can still get the "NAME" of printers through the printer_list as only the array keys
"DESCRIPTION" and "COMMENT" crash and not the "NAME" key.
$list_printers = printer_list(PRINTER_ENUM_LOCAL |
PRINTER_ENUM_SHARED);
// get the name of the first returned printer
//(you can add array walk function to get all printer names if you wish.. but I am lazy)
$this_printer = $list_printers[0]["NAME"];
// open a connection to your printer
$my_printer = printer_open($this_printer);
.. blah blah
The output of var_dump (as an example)
var_dump( printer_list(PRINTER_ENUM_LOCAL | PRINTER_ENUM_SHARED) );
array(1) {
[0]=> array(3) {
["NAME"]=> string(14) "Canon BJC-4550"
["DESCRIPTION"]=> string(30) "Canon BJC-4550,Canon BJC-4550,"
["COMMENT"]=> string(0) "This is my funky printer!" } }
As you can see var_dump (under variable functions in the manual) shows and/or retrieves the corrent
information but if you try to place into a variable or read the variable it crashes either apache
using php4apache.dll or php when you the command line client or cgi.
So as long as you do not get the comment or description it will list your printers.
----
Manual Page -- http://www.php.net/manual/en/function.printer-list.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33032
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33032&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33032&report=yes