Reading USB data

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Tiooso
Forum Newbie
Posts: 1
Joined: Mon Jul 18, 2011 2:29 am

Reading USB data

Post by Tiooso »

I have a computer (XP) with Apache and php.
Connected to this pc with a USB cable I have a machine that is sending chip numbers and time data into the USB cable. This machine is taking income times for competitions (running, cycling, cross country skiing).
A MySQL database is holding the information about chip numbers, competitors and starting time.
I maintain competitors with web pages and php scripts. Result list shall be made with this system.
I want a script to receive the info from the USB cable and insert the info into a table in my MySQL database.

1. How do I get my php script to receive the info from the USB cable?

Tiooso
Peter Kelly
Forum Contributor
Posts: 143
Joined: Fri Jan 14, 2011 5:33 pm
Location: England
Contact:

Re: Reading USB data

Post by Peter Kelly »

I think you would need to look at a windows server IIS web server for what your looking for. I dont believe it can be done by Apache and PHP.
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: Reading USB data

Post by McInfo »

This serial device class might be useful.

If the data is meant to stream for more than a few seconds, I suggest not using a web server. Instead, write a command-line application.

If the data is stored in files on the device, I suggest simply using filesystem functions like fopen() or file_get_contents().
beetree
Forum Commoner
Posts: 26
Joined: Mon Jul 18, 2011 6:30 pm
Location: Peninsula

Re: Reading USB data

Post by beetree »

McInfo wrote:This serial device class might be useful.

If the data is meant to stream for more than a few seconds, I suggest not using a web server. Instead, write a command-line application.

If the data is stored in files on the device, I suggest simply using filesystem functions like fopen() or file_get_contents().
Also, you probably want to consider user-rights. You might not want to have the user that runs the webserver to have access to the USB-port. Hence, set up a different user with access to the USB-port and write a command-line script that this user runs and inserts the data into the MySQL server. Then fetch the data with the PHP-script run by the webserver.
Post Reply