Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to link access card reader with PHP?

I want to use an access card reader with PHP. I am doing this to monitor attendance at a college. Is there any intermediate technology which can be used to take the readings from access card reader to the database?

like image 324
udaya Avatar asked Mar 03 '10 03:03

udaya


3 Answers

I know I'm late to this question, but I'm building a similar product. This is in fact possible with a simple card reader contrary to the other answers. USB based card readers act as simple keyboard input devices, so when a person is ready to swipe, make sure that a text box is in focus and then swipe.

From there, you can take the keyboard data that is read and push it to a hidden input box and then process it server side (or even client side with some JavaScript). I'm using a lot of jQuery to make things a little more seamless on the client side, so it's not as straightforward as I'm describing, but it's definitely possible.

Here's a .NET example that you can use to port to PHP

EDIT: 2/2016

I created a GitHub Gist with a very simple jQuery implementation.

like image 155
AngeloS Avatar answered Oct 19 '22 20:10

AngeloS


I've worked with a bar code scanner before, and I know the one we had acted like a keyboard and basically "typed" in what it read, and hit enter. Maybe your card reader can or does do something similar?

If that's the case, you could set up a very simple form with a text input and with JavaScript, auto-focus on the input. Then have the form submit to a PHP script that logs what it's given.

I have seen a card scanner used as a time-keeping device once. My company had it on a computer, with a page with a current status full-screen on the monitor. When someone swiped their card, it would fire off a Perl program and update the database. I think the page was set to refresh every so many seconds.

Hope something I've said sparks an idea for you.

like image 31
Collin Klopfenstein Avatar answered Oct 19 '22 19:10

Collin Klopfenstein


Likely, this cannot easily be integrated with PHP. Perhaps for a backend API interface via JSON or something, but the card reader interface will need to be something that can run and work with physical hardware.

Unless you mean, you already have the readings and want to put it in a database...PHP can parse it.

like image 37
Xorlev Avatar answered Oct 19 '22 20:10

Xorlev