Jump to content

Archived

This topic is now archived and is closed to further replies.

chaiwei

smartcard reader with php

Recommended Posts

Dear Phpfreaks,

 

I need to develop a smartcard reader application in my college,

but I doesn't aware of if PHP is able to do this kind of thing.

I have a iris smart card reader, and the driver,

but I don't how to use PHP to communicate with the devices.

 

I have googling for almost 1 weeks, it seems like PHP is not cater for it.

I have search for PHP-GTK, roadsand, but I don't know how to do it.

Additionally I have found a script using C language is able to get the data.

It generate a few files.

http://forum.lowyat.net/topic/355950#19

 

So is there got any other workarounds to solve it?

Maybe used PHP to execute the C script on client PC.

and upload the file to server and server convert it?

 

Please advise and your comments or idea is very much appreciated.

thank you.

 

Share this post


Link to post
Share on other sites

As you have noticed, PHP is not the best tool for it.

You could probably find a PHP extension (or write your own - in C) that would allow you to read from RS232 or USB (whichever this reader uses).

You could use PHP's exec command to execute programs written in other languages.

You can even use PHP-Java intergration if you manage to find/create Java classes to connect to the reader.

Share this post


Link to post
Share on other sites

Thank you for your help,

please allow me to have few more questions.

 

So you means with php exec function, can I execute client's pc script language?

or you mean I install the php server on the client PC?

 

As per documentation on php-java, the requirement stated as below

You need a Java VM installed on your machine to use this extension.

the java VM is installed in client PC right?

 

Or server also needed?

Is that possible to install java in ubuntu server?

 

 

Share this post


Link to post
Share on other sites

PHP always runs on a server.

 

If you need these card readers to be installed on client computers, you should create client programs in whatever language suits you best, that would communicate over network with your PHP application.

 

Yes, it is possible to install JavaVM on linux.

Share this post


Link to post
Share on other sites
that would communicate over network with your PHP application.

Let said, I build a VB application client programs, and it connect with

mysql database on server. and then I create a php script on server

for web based reports for admin to manage/view.

 

Is this "communicate over network with your PHP application" like what you mean?

 

I have only use PHP most of the time.

Do you have any recommendation language for me to use to create the client programs?

 

VB6, VB.Net, Python, C, C++, c#, perl, java?

 

The client program must be GUI and is able to connect to other devices.

 

Thank you for spending your time to help me. I very appreciate that.

 

Share this post


Link to post
Share on other sites

Whne choosing a language for your client application you should take two things into consideration:

1. How familiar are you with it/ how easy it will be for you to learn it

2. How easy it will be to connect to your device.

 

You might also want to check with device's producer, if they provide ready to use libraries that you can use when creating your application. Might save you a lot of time.

 

For Windows a Visual C++ will be probably the best choice.

 

Let said, I build a VB application client programs, and it connect with

mysql database on server. and then I create a php script on server

for web based reports for admin to manage/view.

 

You could do it that way. Just make sure that mysql user that client applications run as do not have root privileges. Give them access only to do what they need to do.

Share this post


Link to post
Share on other sites

Thanks for the great info, but did Visual C++ required license to develop?

I plan to consider open source language since I have limited budget as a student.

 

Btw, what is the advantage of using c++ over VB6 or VB.NET?

 

Please advise.

Thank you again for your time and great help.

 

Share this post


Link to post
Share on other sites

You need no license, and basic version of Visual Studio C++ is free. You might also have an access to more advanced versions, if your university has a MSDNAA agreement.

 

I have close to none experience with VB, so I can't tell if there's how easy it is to access Windows API, which is what you'll most likely have to do to. I know C++ can do this.

Share this post


Link to post
Share on other sites

Thank you.

So you mean C++ can do the GUI by using win32 API?

Is there any tutorials or website for me to refer that?

 

So if I have created the cpp file, so I just need to compile it to exe file?

and the exe file will automatic call the win32 API and generate the GUI?

 

Is that got any editor for me to use in order to generate the GUI like drag and drop?

Or I have to manually write my own coding?

 

Is c++ more powerful compare to perl or python?

I really got zero knowledge on that.

 

and C++ can run on linux operating system?

 

Again, thank you for your time and your great help

Share this post


Link to post
Share on other sites

Visual C++ let's you create Windows GUI applications

http://www.microsoft.com/express/Windows/

 

If you need your application to run on both Windows and Linux, I'm afraid I have no knowledge about that. It surely is possible using some libraries, but I have never tried that.

Share this post


Link to post
Share on other sites

Is c++ more powerful compare to perl or python?

 

These are totally different languages and very hard to compare. In general C(++) is considered to be 'lower level' in relation to php, python, perl, that is it's closer tied with the operating system and sometimes even with hardware. Notice that a PHP script will in most cases run equally well on Windows,Linux and MacOS, as well as on Intel, AMD and Sparc. With C and similar languages, it's not that easy to assure cross platform portaibility. The gain however is that C and other low level languages are faster.

 

Share this post


Link to post
Share on other sites
C(++) is considered to be 'lower level' in relation to php

 

What does it mean by "lower level in relation to php"?

Sorry, I don't get you. Is it we can compile php script to c++ and run on server?

 

But what is the purpose to convert PHP into c++? (is it call extending and embedding php to c)?

after convert, it will harder to maintain from what I see.

 

 

or the other way rounds,

example like I write a c++ script and compile it become a php extension install on server.

then I can use the c++ function in php script?

 

Let said PHP GD library orginal is written using C++, and then

I compile it become PHP extension and install it on server.

 

-----------------------

 

Every devices/hardware must have it's own driver, which is dll file right?

so is that means the dll for the devices, is the API/key/library to provide a bridge between software and hardware?

 

So let said I have a USB webcam, in order to use, I must install its own driver.

Then if I want to create a software/client programs to control the webcam,

example like, do a snapshot, or even like MSN, create a video conferencing.

I must use C++ to include the dll file? in order for my script to talk with to devices.

 

 

So as you said

python, perl, that is it's closer tied with the operating system and sometimes even with hardware

 

Like those scanner, web cam, microphone is it easier or better to develop using python instead of c++,

or perl, java?

 

 

Example I saw a smartcard reader script develop using c language.

Have a look on the attachment.

 

How do I know which file I need to include in order to communicate with the devices?

 

winscard.h?

scarderr.h?

SCARD_E_NO_READERS_AVAILABLE?

 

 

 

[attachment deleted by admin]

Share this post


Link to post
Share on other sites

Please see here on explanation on low-level vs high-level language:

 

http://en.wikipedia.org/wiki/Low-level_programming_language

 

Although C/C++ are considered high-level, they are on lower level than interpreted languages like PHP,Perl,Python.

 

A PHP interpreter that lets your computer run PHP scripts is in fact a program written in C.

 

As to if device needs a driver or not, it depends on what interface it's using. If it's connected through RS232, then the driver is not needed (because all you need is an RS232 driver which is bundled with your system usually). If the device is connected through USB, then you usually need to have a driver or write your own. Don't ask me how. I've never even tried.

 

Share this post


Link to post
Share on other sites

How about using PHP cli, is that possible to use php cli to communicate with webcam/smart card reader?

Please advise.

Share this post


Link to post
Share on other sites

No difference. It's still (mostly) same API

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.