user622378
user622378

Reputation: 2336

Receipt printer - print automatically when someone placed an order?

I have bought a receipt printer and connected to Serial COM1 on my computer. I want to print a receipt automatically when someone placed an order online. How can that be done?

I developed a shopping cart website in PHP / MySQL; the server located at the data center.

Upvotes: 0

Views: 3513

Answers (3)

ncuesta
ncuesta

Reputation: 760

What about having PHP sending a request to a specific port in the server that triggers the printer?

I mean, you should have a server listening on a specific port on your computer that will receive the data to print or the primary key for the database row in which the data is stored, and once obtained such data, it will automatically send it to the printer.

Upvotes: 0

NDM
NDM

Reputation: 6830

Ok so your website is in a datacenter, and your printer at home, that kind of sounds like it's not going to work...

Here's what you need:
- A network printer or printer server which allows you to add jobs via a web API
- This API must be reachable from the outside (from the datacenter) so you need a static IP or some service like dyndns...
- you need to extend your website to send the receipt to the printer queue

But if I were you, I wouldn't start on making this happen...

A better solution might be a program which runs on your local computer and connects to the database of your website to check wether orders are placed, and creates a receipt and sends this to the printer...

Upvotes: 2

Blair McMillan
Blair McMillan

Reputation: 5349

You will need something running locally that monitors your database for new orders and generates an appropriate file that gets sent to the printer.

You could do this by running another web server locally and doing something in PHP. Otherwise, there's probably programs that you could purchase.

Upvotes: 0

Related Questions