Jump to content

HTTP POST.......


unplugged_web

Recommended Posts

I've now been given access to the server and told it's not a web server but it does have unrestricted access. Is there any other way of doing this or MUST it be a web server? The computer is already connected to the printer?
Is it a Windows computer or not?If it is, can you install anything on it or not?If you can, what's the problem?
Link to comment
Share on other sites

You just need *a* web server that has access to the print server. If the print server is a web server, then you already have all the code you need and it's really easy. If you want to use another web server to get the request and do the print job on the other computer, then you're going to need an application in something like C++ that the web server can execute to connect to the print server and queue the print job. If that's what you need to do then you'll probably have to hire a C++ programmer to create that application for you.

Link to comment
Share on other sites

  • 2 weeks later...

Sorry to be such a pain with this, I know I'm driving everybody made about this. But I'm now in the proccess of creating the web server, but have just found out that I can't switch the IIS off because that is being used for online orders. Does this means that I can't use Apache?. Is there a way I can do this with IIS instead of Apache?

Link to comment
Share on other sites

Sorry to be such a pain with this, I know I'm driving everybody made about this. But I'm now in the proccess of creating the web server, but have just found out that I can't switch the IIS off because that is being used for online orders. Does this means that I can't use Apache?. Is there a way I can do this with IIS instead of Apache?
Yes. PHP can run on IIS as well. However, the installation process is different and I for one can't be of much assistance there.Here's one guide for that though, and you can search for "PHP IIS installation" to find other articles. If anything, the PHP manual part of it can be used as a last resort.Or, if you want, you can still use Apache. Just, after the installation, when Apache fails to start (because of IIS), go to "C:\Program Files\Apache Software Foundation\Apache2.2\conf\" and open httpd.conf. In it, find the line
Listen 80

and adjust the number to something else, like 81 for example, i.e.

Listen 81

And then try to start Apache again ("Start > All Programs > Apache HTTP Server 2.2 > Control Apache Server > Start").When you want to access Apache, you'd have to type not just the computer's IP adress, but also ":81" before the actual path. For example, to access "printer.php" residing in the document root (wchich would normally mean "http://localhost/printer.php") you'd have to instead type "http://localhost:81/printer.php".

Link to comment
Share on other sites

Yes. PHP can run on IIS as well. However, the installation process is different and I for one can't be of much assistance there.Here's one guide for that though, and you can search for "PHP IIS installation" to find other articles. If anything, the PHP manual part of it can be used as a last resort.Or, if you want, you can still use Apache. Just, after the installation, when Apache fails to start (because of IIS), go to "C:\Program Files\Apache Software Foundation\Apache2.2\conf\" and open httpd.conf. In it, find the line
Listen 80

and adjust the number to something else, like 81 for example, i.e.

Listen 81

And then try to start Apache again ("Start > All Programs > Apache HTTP Server 2.2 > Control Apache Server > Start").When you want to access Apache, you'd have to type not just the computer's IP adress, but also ":81" before the actual path. For example, to access "printer.php" residing in the document root (wchich would normally mean "http://localhost/printer.php") you'd have to instead type "http://localhost:81/printer.php".

Thanks, I changed that and can now use Apache as well, just having a few issues with viewing the test php page now. It says I can't view the page because of error 403 so I'm now just trying to change the security settings
Link to comment
Share on other sites

Thanks, I changed that and can now use Apache as well, just having a few issues with viewing the test php page now. It says I can't view the page because of error 403 so I'm now just trying to change the security settings
okay I've now installed everything and when I go to the printer.php file I get an error saying:
Fatal error: Call to undefined function printer_open() in C:\webs\test\printer.php on line 2
Line to is:
$handle = printer_open();

In the php.ini file I changed where extensions are to:

extension_dir = "c:\php\ext"
and added
extension=php_printer.dll
to the bottom of where all of the other Windows Exensions are. I've also checked the php/ext folder and the php_printer.dll file is definitely there. I'm using php5.2.6 so downloaded the php5.2.1 version
Link to comment
Share on other sites

Make sure it's using the correct php.ini file. Create a php file with only this:<?php phpinfo(); ?>And run that, it will tell you near the top where the config file is that it's using. Make sure that's the file that you're editing.

Link to comment
Share on other sites

Make sure it's using the correct php.ini file. Create a php file with only this:<?php phpinfo(); ?>And run that, it will tell you near the top where the config file is that it's using. Make sure that's the file that you're editing.
I've just done that and it is the one I'm editing. I did notice on thing in the php.ini file though and I don't know if that makes a difference. It said:
Whether or not to enable the dl() function. The dl() function does NOT work; properly in multithreaded servers, such as IIS or Zeus, and is automatically; disabled on them.enable_dl = On
Well the IIS is also running although I'm doing this through Apache, would that make a difference?
Link to comment
Share on other sites

Okay I managed to get it working, there was a ; before the extension and I just removed that to get it working. When I go to the test script though the browser says it's printing, but a window opens asking me to save it. It asks me to save it as XPS, but won't actually let me save it at all, every time I try to save it noting happens. I've checked the printer as well and it says that its printing, but when I close the window the printer queue disappears. I'm doing this remotely so can't see the actual printer, but the person at the other end hasn't received anything from the printer. I've also just been told that they are using 80mm wide thermal printers, this should still work with those printers though, shouldn't it?

Link to comment
Share on other sites

Windows has a unified printing system so any installed printer should work. What does your code look like to print?
I'm using:
<?php$handle = printer_open();printer_write($handle, "This is a printing test");printer_close($handle);echo "Printer should start printing...";?>

to get it to print. The "Printer should start printing..." is shown on the screen and the printer says it's printing a php generated document, but it won't print it because a dialog box comes up prompting me to save it in .xps format, but when I go save nothing happens - I can't save it. If there's a way to bypass the save bit I think it'll work because everything else works and is set up right

Link to comment
Share on other sites

Sounds like your default printer is the "Microsoft XPS Document Writer".You can know your default printer by looking at the icon with a checkmark in the top right corder of it (or top left on Vista I think).There are two things you may do here. Do either of them (no need to do both):1. Set the default printer to be the real printer. That is, go to "Start > Control Panel > Printers and Faxes" and then right click on your printer and click "Set as Default Printer".2. In PHP, explicitly write the printer name in printer_open(). To find the name go (like in the previous way) to "Start > Control Panel > Printers and Faxes".

Link to comment
Share on other sites

Sounds like your default printer is the "Microsoft XPS Document Writer".You can know your default printer by looking at the icon with a checkmark in the top right corder of it (or top left on Vista I think).There are two things you may do here. Do either of them (no need to do both):1. Set the default printer to be the real printer. That is, go to "Start > Control Panel > Printers and Faxes" and then right click on your printer and click "Set as Default Printer".2. In PHP, explicitly write the printer name in printer_open(). To find the name go (like in the previous way) to "Start > Control Panel > Printers and Faxes".
That printer is already set as the default printer so I changed printer_open() to printer_open("Microsoft XPS Document Writer"), but I was still prompted to save it. I also tried setting the other two printers as default printers, but neither of them did anything different, they both still asked me to save the document
Link to comment
Share on other sites

Wait... in what order did you do these things? What two other printers?You must set the correct printer in printer_open() or set the correct printer as the default and not set anything in printer_open(). "Microsoft XPS Document Writer" is NOT the printer you want."Microsoft XPS Document Writer" is a virtual printer (i.e. it doesn't exist as a real device) that "prints" your documents to an XPS file."Microsoft Office Document Image Writer" is a similar printer that instead writes its input to an image file (a tiff one I believe).You need something else. The printer should most likely be called as the name of the model of your printer. The printer's drivers must be installed on the same machine where PHP is.What are the names of all printers you have and what is the name and model of your printer? Are you absolutely sure the printer is installed on the exact same machine where the web server is running?

Link to comment
Share on other sites

Wait... in what order did you do these things? What two other printers?You must set the correct printer in printer_open() or set the correct printer as the default and not set anything in printer_open(). "Microsoft XPS Document Writer" is NOT the printer you want."Microsoft XPS Document Writer" is a virtual printer (i.e. it doesn't exist as a real device) that "prints" your documents to an XPS file."Microsoft Office Document Image Writer" is a similar printer that instead writes its input to an image file (a tiff one I believe).You need something else. The printer should most likely be called as the name of the model of your printer. The printer's drivers must be installed on the same machine where PHP is.What are the names of all printers you have and what is the name and model of your printer? Are you absolutely sure the printer is installed on the exact same machine where the web server is running?
Oh, I didn't realise the Microsoft XPS Document Writer wasn't a really printer. The printers listed are:Auto Microsoft XPS Document Writer on BEEMMEUPLAPTOPAuto Microsoft XPS Document Writer on STATION1Microsoft XPS Document WriterI guess that means that none of them are printers then?I was told that there was a printer connected to the computer, but it doesn't sound like there is. As I'm prompted to save the document does that mean it's worked?
Link to comment
Share on other sites

Oh, I didn't realise the Microsoft XPS Document Writer wasn't a really printer. The printers listed are:Auto Microsoft XPS Document Writer on BEEMMEUPLAPTOPAuto Microsoft XPS Document Writer on STATION1Microsoft XPS Document WriterI guess that means that none of them are printers then?I was told that there was a printer connected to the computer, but it doesn't sound like there is. As I'm prompted to save the document does that mean it's worked?
Yep. The printer extension works. It's now just a matter of installing the printer and getting it appear in the control panel.On the very least, you must install the printer elsewhere and then register it on the web server and access it like "\\IPaddressOfThatOtherComputer\TheNameOfThePrinterAsSeenOnThatOtherComputer".Or better (and easier) yet, install it on the same PC on which the web server is already installed.
Link to comment
Share on other sites

Yep. The printer extension works. It's now just a matter of installing the printer and getting it appear in the control panel.On the very least, you must install the printer elsewhere and then register it on the web server and access it like "\\IPaddressOfThatOtherComputer\TheNameOfThePrinterAsSeenOnThatOtherComputer".Or better (and easier) yet, install it on the same PC on which the web server is already installed.
Great thank you so much for your help. Hopefully I'll leave you in peace now :)
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...