9

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?

DRosenfeld
  • 115
  • 1
  • 9
udaya
  • 9,598
  • 15
  • 48
  • 67
  • Will the card reader be physically attached to the server, or do you require to get the reading from a client through the browser? – deceze Mar 03 '10 at 03:25

5 Answers5

17

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.

AngeloS
  • 5,536
  • 7
  • 40
  • 58
5

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.

Collin Klopfenstein
  • 2,265
  • 4
  • 21
  • 22
1

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.

Xorlev
  • 8,561
  • 3
  • 34
  • 36
  • I DONT HAVE READING ...THE READING MUST BE RECEIVED FROM THE CARD READER ONLY .....I AM SEARCHING FOR THAT KIND OF INTERFACE – udaya Mar 03 '10 at 03:19
  • K i will work on it and wil share the result once i got it tanks – udaya Mar 03 '10 at 06:31
  • Actually, this is possible with PHP. USB card readers act as keyboard input devices which collect information that can be used in a simple inputbox, which PHP can then process. Please see my answer below. – AngeloS Mar 13 '12 at 15:11
0

I believe some of the other guys are right as well as the others. But you also have to remember that some card readers are 3-4 tier if not 1 or 2. You can simply use it as a "keyboard" by a simple swipe but if anything it's going to only read the first line and that's it.

  • Welcome to StackOverflow! Your answer is more in line with a comment, so please put this in as a comment and remove it as an answer. – Steve H. Mar 12 '14 at 03:00
0

If a software was provided along with the reader, you may want to refer to its documentation on how it outputs the data. Let's say, if it gives out a CSV, you may want to parse the CSV and store it in the database, which later can be processed by PHP.

Some reader software are capable of directly writing to the database. Again, it all depends on what brand and model of reader you have got.

Nirmal
  • 9,391
  • 11
  • 57
  • 81
  • Do you know any brand of reader that directly writes to the database – udaya Mar 03 '10 at 05:44
  • I assume you are from India and I don't know about brands there. In Malaysia there is a brand called __Soyal__ which has a range of access controllers with client server software. The software acts as an interface between the reader and the database. Stack Overflow might not be that helpful for this and you need to look at a different forum. – Nirmal Mar 04 '10 at 01:51