1

I have a webshop (on a webserver) where customers can order things, somewhere else (at the customers company) I have a printer which needs to instantly print an packing slip whenever the website receives an order.

  1. I have read things about VPN but that's too difficult to set up;
  2. Some people say it's best to let the website send an e-mail and use software to fetch the pop box and print all incoming e-mail
  3. I could use an IP (xml) printer
  4. Now testing with Google Cloud Print Beta
  5. HP has the Eprinting - sending documents to a specific e-mailaddress function
  6. Via HTML / Javascript -> Chrome in kiosk printing mode and a javascript print function (or something with jquery) which every 3 minutes polls database…</li>

I’m totally free in what to use and how to connect the printer (preferably directly on router or on Windows PC).

Numerous of options but I’m not sure which one is most reliable (given the fact that the order needs to be printed instantly)… Also, the printer / API / software needs to be able to give alert feedback when the printer is offline so a SMS or something can be sent.

I know all about PHP, so using any form of API isn't a problem.

4

1 回答 1

0
$content = "Firts Line\n\r";
$content .= "Second Line";
$content .= char(27).char(ord("E")); // ESC E (command ESC for thermal printers)
$content .= "Line with effect ESC";
$f = @fsockopen($print_ip,$print_port,$errno,$errstr); 
if (!$f) {
    echo "Erro: $errstr<br/>";
    if ($errstr=='No route to host') { die("Verify conncetion."); }
}
else {
    if(fwrite($f, $content)) { echo 'success.'; }
    @fclose($f);
}
于 2014-06-03T16:33:49.753 回答