Magnetic Stripe Reader or Barcode to PHP
Magnetic Stripe Reader or Barcode to PHP
am 18.02.2010 23:42:59 von Daevid Vincent
I'll confess that I've done almost zero research on this topic as of right
now aside from pricing readers and blank cards.
So we're opening a new super-club here in Seattle. One of the ideas we'd
like to pursue is that people are assigned a card. This can be a magstripe
card or something with a barcode. Not really sure at the moment which way
to go.
The idea being that when they enter, we "swipe/scan" their card and we can
log stats (# of visits, # guests, favorite drink so the bar has it ready,
enter into contest, etc.) I was thinking we setup a simple netbook with a
USB reader at the front door when they pay. Then we have another back at
the bar. Connect via WiFi. Have a notebook somewhere behind the scenes that
runs LAMP (or a VM thereof). No internet needed. The backend database and
even web/GUI stuff is of course trivial with any LAMP stack.
What I don't know is how do I interface _to_ PHP from say a magstripe
reader. They're dirt cheap ($50), but I assume come with zero software.
http://www.kanecal.net/mag-stripe-reader-scanner.html . And there are
hundreds of these gadgets out there all the same basically.
I guess what I'm hoping for is some pointers, from someone who's done this
sort of thing.
My gut thought is something so simple, where there is some XP software (or
Linux I suppose) that reads the card (and generally they only have a number
encoded on them) and this is sent via a URL we define, such as
http://192.168.10.100/door.php?id=123456 or
http://192.168.10.100/bar.php?id=123456 etc. (ignore the security issues
and all that. It's trivial to encode the parameters, plus it's a closed
system with WEP/WPA/WTF). But does anyone know of such a key piece of code?
Like I said, I'm not locked into magcards. It could be a barcode reader
just as easily. Or fingerprint scanner, or facial recognition. In the end
it's just a unique "thing" that maps to a unique number. I just need the
"FM" (F*ckin' Magic -- it's a programmer term -- look it up!) that goes in
between PHP and the hardware.
http://daevid.com
"Some people, when confronted with a problem, think 'I know, I'll use
XML.'"
Now they have two problems.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Magnetic Stripe Reader or Barcode to PHP
am 19.02.2010 00:01:48 von Matt Neimeyer
If the scanning device hooks into the keyboard somehow it should be
easy. I believe that's called a "keyboard wedge". Basically, you scan
and it types.
My only exposure to this is using one of the old CueCat scanners to
index my personal library into a php app I cobbled together. The
CueCat hooked in line with the keyboard. You'd bring up the scanning
page and an onload Javascript would place the cursor into the "Scan
ISBN Here" text box. Scan the book and the input went where it was
needed. I believe it also sent an "enter" keystroke which submitted
the form. It's been a couple years since I played with it so there
might have been some additional software that kicked the "enter". Then
you process the data as you would for any other text field submission.
It worked well enough to catalog a couple thousand books in a single
evening.
Hope this helps
Matt
On Thu, Feb 18, 2010 at 5:42 PM, Daevid Vincent wrote:
> So we're opening a new super-club here in Seattle. One of the ideas we'd
> like to pursue is that people are assigned a card. This can be a magstripe
> card or something with a barcode. Not really sure at the moment which way
> to go.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Magnetic Stripe Reader or Barcode to PHP
am 19.02.2010 00:18:38 von Phpster
The inputs are simple client side devices, lime th keyboard. I used as
wasp brand barcode reader and it was configured to input the value and
the tab to send it to te next field. They work well and easy to set up.
Bastien
Sent from my iPod
On Feb 18, 2010, at 5:42 PM, "Daevid Vincent" wrote:
> I'll confess that I've done almost zero research on this topic as of
> right
> now aside from pricing readers and blank cards.
>
> So we're opening a new super-club here in Seattle. One of the ideas
> we'd
> like to pursue is that people are assigned a card. This can be a
> magstripe
> card or something with a barcode. Not really sure at the moment
> which way
> to go.
>
> The idea being that when they enter, we "swipe/scan" their card and
> we can
> log stats (# of visits, # guests, favorite drink so the bar has it
> ready,
> enter into contest, etc.) I was thinking we setup a simple netbook
> with a
> USB reader at the front door when they pay. Then we have another
> back at
> the bar. Connect via WiFi. Have a notebook somewhere behind the
> scenes that
> runs LAMP (or a VM thereof). No internet needed. The backend
> database and
> even web/GUI stuff is of course trivial with any LAMP stack.
>
> What I don't know is how do I interface _to_ PHP from say a magstripe
> reader. They're dirt cheap ($50), but I assume come with zero
> software.
> http://www.kanecal.net/mag-stripe-reader-scanner.html . And there are
> hundreds of these gadgets out there all the same basically.
>
> I guess what I'm hoping for is some pointers, from someone who's
> done this
> sort of thing.
>
> My gut thought is something so simple, where there is some XP
> software (or
> Linux I suppose) that reads the card (and generally they only have a
> number
> encoded on them) and this is sent via a URL we define, such as
> http://192.168.10.100/door.php?id=123456 or
> http://192.168.10.100/bar.php?id=123456 etc. (ignore the security
> issues
> and all that. It's trivial to encode the parameters, plus it's a
> closed
> system with WEP/WPA/WTF). But does anyone know of such a key piece
> of code?
>
> Like I said, I'm not locked into magcards. It could be a barcode
> reader
> just as easily. Or fingerprint scanner, or facial recognition. In
> the end
> it's just a unique "thing" that maps to a unique number. I just need
> the
> "FM" (F*ckin' Magic -- it's a programmer term -- look it up!) that
> goes in
> between PHP and the hardware.
>
> http://daevid.com
>
> "Some people, when confronted with a problem, think 'I know, I'll use
> XML.'"
> Now they have two problems.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: Magnetic Stripe Reader or Barcode to PHP
am 19.02.2010 01:38:26 von williams
Bar code scanners can be setup to decode the scan code on the card and
output it as text. On your incoming site, place cursor in text box, scan
card, code on card is entered as text, hit enter, text field sent to
database where all the F* Magic takes place.
You will also need a method to create the cards and get the data into
the database associated with the number. You can use Word or other text
program and a bar code font to print the cards with bar-code, or use
pre-printed peel and stick barcode labels to place on a card. To
Initialize the card, have an new member interface where the data for the
member is entered, along with their bar-coded number.
There are a LARGE number of bar-code codes. Pick one of the more common
that uses alphanumeric and symbols.
Tips: Have a backup reader or hard wire the bar-code scanner into a
power outlet. The cheaper hand held ones don't have a very good battery
life. Print the number on the card under the bar code. This will help
when a drink smears the bar code or it becomes unreadable. The door
person can enter the number by hand.
Dewey Williams
> -----Original Message-----
> From: Daevid Vincent [mailto:daevid@daevid.com]
> Sent: Thursday, February 18, 2010 5:43 PM
> To: php-general@lists.php.net
> Subject: [PHP] Magnetic Stripe Reader or Barcode to PHP
>=20
> I'll confess that I've done almost zero research on this topic as of
> right
> now aside from pricing readers and blank cards.
>=20
> So we're opening a new super-club here in Seattle. One of the ideas
> we'd
> like to pursue is that people are assigned a card. This can be a
> magstripe
> card or something with a barcode. Not really sure at the moment which
> way
> to go.
>=20
> The idea being that when they enter, we "swipe/scan" their card and we
> can
> log stats (# of visits, # guests, favorite drink so the bar has it
> ready,
> enter into contest, etc.) I was thinking we setup a simple netbook
with
> a
> USB reader at the front door when they pay. Then we have another back
> at
> the bar. Connect via WiFi. Have a notebook somewhere behind the scenes
> that
> runs LAMP (or a VM thereof). No internet needed. The backend database
> and
> even web/GUI stuff is of course trivial with any LAMP stack.
>=20
> What I don't know is how do I interface _to_ PHP from say a magstripe
> reader. They're dirt cheap ($50), but I assume come with zero
software.
> http://www.kanecal.net/mag-stripe-reader-scanner.html . And there are
> hundreds of these gadgets out there all the same basically.
>=20
> I guess what I'm hoping for is some pointers, from someone who's done
> this
> sort of thing.
>=20
> My gut thought is something so simple, where there is some XP software
> (or
> Linux I suppose) that reads the card (and generally they only have a
> number
> encoded on them) and this is sent via a URL we define, such as
> http://192.168.10.100/door.php?id=3D123456 or
> http://192.168.10.100/bar.php?id=3D123456 etc. (ignore the security
> issues
> and all that. It's trivial to encode the parameters, plus it's a
closed
> system with WEP/WPA/WTF). But does anyone know of such a key piece of
> code?
>=20
> Like I said, I'm not locked into magcards. It could be a barcode
reader
> just as easily. Or fingerprint scanner, or facial recognition. In the
> end
> it's just a unique "thing" that maps to a unique number. I just need
> the
> "FM" (F*ckin' Magic -- it's a programmer term -- look it up!) that
goes
> in
> between PHP and the hardware.
>=20
> http://daevid.com
>=20
> "Some people, when confronted with a problem, think 'I know, I'll use
> XML.'"
> Now they have two problems.
>=20
>=20
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Magnetic Stripe Reader or Barcode to PHP
am 19.02.2010 05:34:14 von Nathan Nobbe
--001636b2bc2186127e047fec980f
Content-Type: text/plain; charset=UTF-8
On Thu, Feb 18, 2010 at 3:42 PM, Daevid Vincent wrote:
> I'll confess that I've done almost zero research on this topic as of right
> now aside from pricing readers and blank cards.
>
> So we're opening a new super-club here in Seattle. One of the ideas we'd
> like to pursue is that people are assigned a card. This can be a magstripe
> card or something with a barcode. Not really sure at the moment which way
> to go.
>
> The idea being that when they enter, we "swipe/scan" their card and we can
> log stats (# of visits, # guests, favorite drink so the bar has it ready,
> enter into contest, etc.) I was thinking we setup a simple netbook with a
> USB reader at the front door when they pay. Then we have another back at
> the bar. Connect via WiFi. Have a notebook somewhere behind the scenes that
> runs LAMP (or a VM thereof). No internet needed. The backend database and
> even web/GUI stuff is of course trivial with any LAMP stack.
>
> What I don't know is how do I interface _to_ PHP from say a magstripe
> reader. They're dirt cheap ($50), but I assume come with zero software.
> http://www.kanecal.net/mag-stripe-reader-scanner.html . And there are
> hundreds of these gadgets out there all the same basically.
>
> I guess what I'm hoping for is some pointers, from someone who's done this
> sort of thing.
>
> My gut thought is something so simple, where there is some XP software (or
> Linux I suppose) that reads the card (and generally they only have a number
> encoded on them) and this is sent via a URL we define, such as
> http://192.168.10.100/door.php?id=123456 or
> http://192.168.10.100/bar.php?id=123456 etc. (ignore the security issues
> and all that. It's trivial to encode the parameters, plus it's a closed
> system with WEP/WPA/WTF). But does anyone know of such a key piece of code?
>
> Like I said, I'm not locked into magcards. It could be a barcode reader
> just as easily. Or fingerprint scanner, or facial recognition. In the end
> it's just a unique "thing" that maps to a unique number. I just need the
> "FM" (F*ckin' Magic -- it's a programmer term -- look it up!) that goes in
> between PHP and the hardware.
>
DISCLAIMER - THOU ART ABOUT TO BEHOLD A RANT ...
ok, so it all started out a few years back when i started a company set out
to build a wireless capture portal. we wanted to integrate with a 2-Touch
POS which had 'gift cards' which were magcards. the idea was someone buys a
drink, the clerk swipes the card and the customer gets a window of time on
the internet.
so heres the deal (on linux [likely similar on other OS' though not sure on
the implementation there]). when you attach a usb card reader, barcode
scanner or similar, if you have linux USB HID (HumanInputDevice) support the
kernel magically uses the module to treat input from the device as keyboard
input; simple right...
well this only works iff you have a terminal for the output to arrive at.
if you dont it goes nowhere (likely /dev/null or similar). so if you want
something quick and dirty, a laptop or any box w/ a full window manager or
just a terminal will capture the output. but thats for newbs (haha)...
the way we rolled w/ my product was w/ a linux server, running as the local
gateway w/ a full lamp stack to provide a UI for the business owner and the
customers. new problem - how to capture the output of the device w/o a
terminal or UI on the server. to cut to the chase we ended up developing a
*user space* driver for the card reader via libusb (which is cross-platform
btw). i started out trying the java wrappers, but they all sucked ass.. so
ended up going w/ C.
basically, we wrote a simple single threaded daemon which sits and listens
for card swipes, once the card is swiped, the daemon uses the C system()
function to invoke a configurable executable program (which in our case was
a php script :)) and passes the captured info from the card via the shell.
the code is semi-generic but frankly we stopped off where our needs did at
the time. the only real limitations are:
.. it only provides a fraction of the info from the card (all info could be
passed ideally)
.. it has hardcoded values for a minimag card reader (easily changed - these
are just values to identify the proper hardware in the USB tree and bind to
it)
.. single threaded - it would be nice to have a main listener thread and fork
child threads to process the swipes (thats where binary from the device is
converted to ascii based on the usb2.0 spec) believe it or not you can
actually send 2 swipes before the first one is processed w/ a single thread
if you swipe it quickly enough!
.. dependent on glib for some string functionality - i think it would be nice
to see it have as few dependencies beyond libusb (and pthreads if ever it
was threaded), though glib is quite common afaik
we originally ran the software on gentoo, but it could be packaged up for
pretty much any OS afaik since libusb is cross-platform.
anyways, if this is interesting at all im happy to share the code. i was
planning to touch it up a bit at some point but dont have the time atm. i
would be happy to help someone work with the code to tie it into their
system and put it to good use.
-nathan
--001636b2bc2186127e047fec980f--
Re: Magnetic Stripe Reader or Barcode to PHP
am 19.02.2010 11:37:27 von Richard Quadling
On 18 February 2010 22:42, Daevid Vincent wrote:
> I'll confess that I've done almost zero research on this topic as of righ=
t
> now aside from pricing readers and blank cards.
>
> So we're opening a new super-club here in Seattle. One of the ideas we'd
> like to pursue is that people are assigned a card. This can be a magstrip=
e
> card or something with a barcode. Not really sure at the moment which way
> to go.
>
> The idea being that when they enter, we "swipe/scan" their card and we ca=
n
> log stats (# of visits, # guests, favorite drink so the bar has it ready,
> enter into contest, etc.) I was thinking we setup a simple netbook with a
> USB reader at the front door when they pay. Then we have another back at
> the bar. Connect via WiFi. Have a notebook somewhere behind the scenes th=
at
> runs LAMP (or a VM thereof). No internet needed. Â The backend databa=
se and
> even web/GUI stuff is of course trivial with any LAMP stack.
>
> What I don't know is how do I interface _to_ PHP from say a magstripe
> reader. They're dirt cheap ($50), but I assume come with zero software.
> http://www.kanecal.net/mag-stripe-reader-scanner.html . And there are
> hundreds of these gadgets out there all the same basically.
>
> I guess what I'm hoping for is some pointers, from someone who's done thi=
s
> sort of thing.
>
> My gut thought is something so simple, where there is some XP software (o=
r
> Linux I suppose) that reads the card (and generally they only have a numb=
er
> encoded on them) and this is sent via a URL we define, such as
> http://192.168.10.100/door.php?id=3D123456 or
> http://192.168.10.100/bar.php?id=3D123456 etc. (ignore the security issue=
s
> and all that. It's trivial to encode the parameters, plus it's a closed
> system with WEP/WPA/WTF). But does anyone know of such a key piece of cod=
e?
>
> Like I said, I'm not locked into magcards. It could be a barcode reader
> just as easily. Or fingerprint scanner, or facial recognition. In the end
> it's just a unique "thing" that maps to a unique number. I just need the
> "FM" (F*ckin' Magic -- it's a programmer term -- look it up!) that goes i=
n
> between PHP and the hardware.
>
> http://daevid.com
>
> "Some people, when confronted with a problem, think 'I know, I'll use
> XML.'"
> Now they have two problems.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I used to develop EPOS (Electronic Point of Sale) s/w.
As already mentioned, most scanners (barcode and magswipe) connect via
the keyboard.
As far as the app is concerned, the data is coming from the keyboard.
You can normally program the barcode scanner to provide a prefix and a
suffix to the data from the scan.
This allows you to provide a "source" to the data.
For example, if you have a web page watching for keypresses, then you
want to know when the data is coming from the scanner rather than the
keyboard.
This allows you to do "out of order" processing. So, you scan 10
items, item 3 requires some additional data, but the next 7 items
aren't "lost" because you didn't deal with item 3. The webpage can
push the barcode data (AJAX maybe) to the server so they are all
logged and fed back as part of the "basket" logic.
If you have a prefix, you'll also need a suffix to tell the app that
the data has finished.
A similar situation exists with mag cards. A normal mag card (like
your credit cards) can have up to 3 "tracks" of data. Normally track 2
is the interesting one and will normally consist of the following
data.
Start Sentinel
Card Number
Mid Sentinel
Expiry Date
Possibly other data (it was a LONG time ago since I was writing EPOS
systems, so ... memory currently giving me a 404.)
End Sentinel
The sentinels aren't full characters, but are "signals" to the reader.
The reader can be programmed to issue a specific character for each
sentinel.
So again, you can read from the mag card "out of order". E.g. you can
scan your club card or your credit card at the beginning of the sale
and then add your items. All without touching the keyboard to change
the "focus" of the input. This was a major enhancement for usability
for our customers when I introduced this. And that was for a DOS app,
not GUI or Web!
If you have an account on Experts Exchange, take a look at
http://www.experts-exchange.com/Internet/Web_Development/Q_2 4179189.html?sf=
QueryTermInfo=3D1+barcod+javascript+rquadling
which was a question on using a barcode reader in a web app and I gave
JS code allowing for the "out of order" processing I mentioned here.
If you are generating your own cards, then the quickest/cheapest way
is to get blank cardboard "cards", print a barcode on them and then
laminate them. That way you can build your own layout relatively
cheaply.
You also don't have to use black/white bars. For one our systems
(Access control to buildings), we used infra-red detectable ink. When
it was printed, we could only just see it in the right light. The
scanners use a red laser and picked up the code easily. And the
barcode was overprinted on a photo ID card and them laminated.
Hope that all makes sense.
Regards,
Richard.
--=20
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=3DZEND002498&r=3D213474=
731
ZOPA : http://uk.zopa.com/member/RQuadling
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Magnetic Stripe Reader or Barcode to PHP
am 19.02.2010 20:24:08 von Shawn McKenzie
Daevid Vincent wrote:
> I'll confess that I've done almost zero research on this topic as of right
> now aside from pricing readers and blank cards.
>
> So we're opening a new super-club here in Seattle. One of the ideas we'd
> like to pursue is that people are assigned a card. This can be a magstripe
> card or something with a barcode. Not really sure at the moment which way
> to go.
>
> The idea being that when they enter, we "swipe/scan" their card and we can
> log stats (# of visits, # guests, favorite drink so the bar has it ready,
> enter into contest, etc.) I was thinking we setup a simple netbook with a
> USB reader at the front door when they pay. Then we have another back at
> the bar. Connect via WiFi. Have a notebook somewhere behind the scenes that
> runs LAMP (or a VM thereof). No internet needed. The backend database and
> even web/GUI stuff is of course trivial with any LAMP stack.
>
> What I don't know is how do I interface _to_ PHP from say a magstripe
> reader. They're dirt cheap ($50), but I assume come with zero software.
> http://www.kanecal.net/mag-stripe-reader-scanner.html . And there are
> hundreds of these gadgets out there all the same basically.
>
> I guess what I'm hoping for is some pointers, from someone who's done this
> sort of thing.
>
> My gut thought is something so simple, where there is some XP software (or
> Linux I suppose) that reads the card (and generally they only have a number
> encoded on them) and this is sent via a URL we define, such as
> http://192.168.10.100/door.php?id=123456 or
> http://192.168.10.100/bar.php?id=123456 etc. (ignore the security issues
> and all that. It's trivial to encode the parameters, plus it's a closed
> system with WEP/WPA/WTF). But does anyone know of such a key piece of code?
>
> Like I said, I'm not locked into magcards. It could be a barcode reader
> just as easily. Or fingerprint scanner, or facial recognition. In the end
> it's just a unique "thing" that maps to a unique number. I just need the
> "FM" (F*ckin' Magic -- it's a programmer term -- look it up!) that goes in
> between PHP and the hardware.
>
> http://daevid.com
>
> "Some people, when confronted with a problem, think 'I know, I'll use
> XML.'"
> Now they have two problems.
>
As someone else pointed out, many of these readers come with software
that automatically enters data into an input field (where the cursor is)
when a card is swiped.
So you have a PHP web app on your LAMP box that the other netbooks point
to. When they swipe the card it inputs into the text field and uses an
onchange() to submit the form and redisplay the form, or have other
fields that need to be populated (guests, etc.).
I haven't done it, but seems simple enough. You just need to figure out
what you'll use. Maybe driver's license since you need that anyway at a
club (at least in the U.S.).
--
Thanks!
-Shawn
http://www.spidean.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php