0

Hello,

I would like to send a specific string of commands to a USB device connected to my computer. Is there a PHP function that allows this?

Thanks,

Choky

3
Contributors
7
Replies
8
Views
12 Years
Discussion Span
Last Post by hollystyles
0

Serial communication has to be done fairly low level using Windows API's.

You can buy a wrapper component called ActiveComport (USB is just a much much faster RS232) here which gives you an interface you can manipulate in scripting languages.

I beleive on Linux it's simpler because everythings a file, so you just read and write your bits to the file that represents your USB port or device, if I find any leads in that direction I'll post them.

0

Thanks! But if it is possible to access USB devices then any webpage can just control your peripherals and cause a mess, no?
Secondly, can PHP give orders to ActiveComport? and if so, what functions can be used? I would like to use PHP for a new POS (point of sale) software I am developing for my shop. The problem is sending orders to the cash drawer/printer using php.

Serial communication has to be done fairly low level using Windows API's.

You can buy a wrapper component called ActiveComport (USB is just a much much faster RS232) here which gives you an interface you can manipulate in scripting languages.

I beleive on Linux it's simpler because everythings a file, so you just read and write your bits to the file that represents your USB port or device, if I find any leads in that direction I'll post them.

0

Any webpage cannot control your USB port, PHP is not just for web pages although that's where it is most commonly used. ActiveComport is a component that you will have to register with the windows registry on the machine on which you are executing your PHP script. I'm afraid I am not an authority on PHP as I have used it very little, and the site I gave does not mention PHP specifically. But if VBScript can use it I would be very surprised if PHP couldn't.

0

Ooh nice, I could find some uses for that, thinking send/receive SMS text messages thru PDA phone.

Choky,
I take it your cash drawer has a USB interface, does it not have any software with it, perhaps the vendor or manufacturer have a development KIT ?

0

This is the printer I will use: http://www.orient-technologies.com/products/pdf/BTP-2002CP.pdf .
The cash drawer connects directly to the printer so when it gets a command to print, it tells the drawer to open. So really what I need is just communication with the printer.


Ooh nice, I could find some uses for that, thinking send/receive SMS text messages thru PDA phone.

Choky,
I take it your cash drawer has a USB interface, does it not have any software with it, perhaps the vendor or manufacturer have a development KIT ?

0

Sorry, I'm really lost here.

Why do you want to mess about with low level stuff like communicating with a printer?

I take it this PHP POS software is going to run on a pc, on which the printer is installed as a device right?

so you just want to create a receipt document from your sales data and just put it in the print queue right ? let your OS worry about talking to the printer.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.