Page 1 of 1
Smart cards,touch screens and PHP
Posted: Wed Nov 29, 2006 7:18 am
by lazaroskyr
I am planning on creating a program that will use smart cards and touch screens.Is PHP suitable for this purpose?I mean can PHP work with smart cards and touch screens?The program will be web based so I must use PHP...
Posted: Wed Nov 29, 2006 8:21 am
by onion2k
PHP can't access smart card technology directly, but it may be possible to access a card reader as a stream from a serial port or USB. Depends on the card reader mostly. You might need to write a small application to act as a go-between between PHP and the card.
When I was making software for kiosk systems many years ago we built a VB 'browser' that was essentially just an IE control in an application for viewing things from a server, but the VB app also had hooks to a smart card reader COM object that we added to used to add data to requests going to the server. It was pretty dodgy to be honest, had a number of problems.
Posted: Wed Nov 29, 2006 8:37 am
by lazaroskyr
So you "advice" me not to use PHP?
Posted: Wed Nov 29, 2006 9:54 am
by onion2k
It depends how your application is going to work. I imagine PHP isn't the best choice though. At least, not for the client machine.
Posted: Wed Nov 29, 2006 11:13 am
by MrPotatoes
you can write an extension. that would be cool.
the touch screen i'm assuming the OS handles like a mouse so you don't have to worry about anything. the browser will handle what was clicked/touched
Posted: Thu Nov 30, 2006 2:45 am
by lazaroskyr
Maybe the best way to describe it is: "can the browser read from a smart card reader like it does with barcodes, touch screens etc"? I suppose that it is wrong to say "php can or cannot read from a smart card".So is there a solution to it or I must stop trying?
Let's say something else.Can I read the data with a java applet and then pass it to php?
Posted: Thu Nov 30, 2006 3:13 am
by Rovas
No Java cannot pass data directly to PHP. But you can use a XML file to pass data, think of AJAX JS+XML+PHP (or another language).
Posted: Thu Nov 30, 2006 3:23 am
by onion2k
A Java app can read from a peripheral device on a computer and pass it to a server page in the same way as any other browser request. If you're doing this purely as a browser based application that's probably your best option.
Posted: Thu Nov 30, 2006 3:29 am
by lazaroskyr
The program is for hotels.The customer pays money in advance to the hotel, takes the smartcard,the money is put into the smart card(like an electronic wallet) and when he/she byes something from the hotel,the money is taken from the smart card.
The program is written in Visual Basic(is working right now) and we want to be web based from now on.So it will be a pure browser/web based program.
So the conclusion is that a browser cannot read from a smart card and I can(?) use java for that purpose?
I wonder if I pass the data that I want from java to a server page,then a server side scripting language can handle it in any way I want?
Posted: Thu Nov 30, 2006 6:03 am
by onion2k
lazaroskyr wrote:The program is for hotels.The customer pays money in advance to the hotel, takes the smartcard,the money is put into the smart card(like an electronic wallet) and when he/she byes something from the hotel,the money is taken from the smart card.
The program is written in Visual Basic(is working right now) and we want to be web based from now on.So it will be a pure browser/web based program.
What is the advantage of converting this system to a web/browser based application?
lazaroskyr wrote:So the conclusion is that a browser cannot read from a smart card and I can(?) use java for that purpose?
A browser cannot read from a smart card on it's own.
lazaroskyr wrote:I wonder if I pass the data that I want from java to a server page,then a server side scripting language can handle it in any way I want?
You could embed a Java application into the page, then the Java could read and write to the smart card, and pass data to the browser, which would in turn pass it to the server.
I really don't see the advantage of using a browser interface at the client level though. You've got a working system at the moment. Why are you scrapping all that? I can see the advantage of having a web based interface for users to put more money onto their card (for example), but that wouldn't need any access to the card itself. Just update the client's balance in a database, and next time they put their card into a cardreader update it assuming the card holds a copy of the balance. On the system I worked on the card just held a unique ID, all the data was stored on a central server.
Posted: Thu Nov 30, 2006 10:12 am
by obiron
When you say smart card, do you mean with a chip or do you mean mag stripe?
Mag stripe would normally only hold a card ID and not the actual money so the money held against the card would be a field in the database. You can get 2 and 3 track readers that plug into the keyboard socket on a 'Wedge' and effectively inject a text string into the IO buffer like the keyboard or a barcode reader would.
If you are talking about a chip then you would need an application to interface with the card reader and PHP would probably not be the correct solution for that because you would need to open a stream on a com port (or send data to an IP address if the reader plugs into the network). I would suspect that any card reader would come with an interface application that you could access with DLLs or activeX components