using PHP Posted March 22, 2011 Share Posted March 22, 2011 Hello, I am learning PHP to take information submitted in a web-form and store it in a MySQL database, but I also need it to automatically print to the laser printer I have setup. So that a notice or printout is produced of the information. My question is... what route do I go to automate printing from web-based information in a PHP/MySQL database? Is it PERL ? or does PHP have a feature to do this? I am willing do to the leg work and accomplish it, I just need some insight of which software technology is going to help me accomplish my goal. Quote Link to comment Share on other sites More sharing options...
Ionisis Posted March 30, 2011 Share Posted March 30, 2011 I'm kinda reaching here, but look into cups (IF you're running Linux). Here's an overview of my theory: 1) use php's fsockopen with fputs to open a socket to the cups server 2) issue a command to print What legwork you'll have to do: 1) research cups's commands that it can accept via the network, and what format they come in. Quote Link to comment Share on other sites More sharing options...
ManiacDan Posted March 31, 2011 Share Posted March 31, 2011 If the printer is hooked to your SERVER, you should be able to spool directly to print jobs on the command line without using socket connections. If the printer is hooked to your CLIENT (the computer you're using to view these reports), you can invoke the print dialog in javascript when you need it, then just click "ok" and it will print. -Dan Quote Link to comment Share on other sites More sharing options...
Ionisis Posted March 31, 2011 Share Posted March 31, 2011 If the printer is hooked to your SERVER, you should be able to spool directly to print jobs on the command line without using socket connections. i assume, by this, you mean using php's system() or exec() functions (you forgot to mention the HOW )? Quote Link to comment Share on other sites More sharing options...
lastkarrde Posted April 1, 2011 Share Posted April 1, 2011 i assume, by this, you mean using php's system() or exec() functions (you forgot to mention the HOW )? Of course. That is how you execute processes using PHP. Quote Link to comment Share on other sites More sharing options...
Ionisis Posted April 1, 2011 Share Posted April 1, 2011 Well, yeah, you and i know that, but this guy may not have, so i though that perhaps i'd be a bit more explicit for him. Anyway here's some docs on command line options that he can call with exec or system: http://www.cups.org/documentation.php/options.html Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.