chaiwei Posted May 11, 2010 Share Posted May 11, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/201376-smartcard-reader-with-php/ Share on other sites More sharing options...
Mchl Posted May 11, 2010 Share Posted May 11, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/201376-smartcard-reader-with-php/#findComment-1056555 Share on other sites More sharing options...
chaiwei Posted May 11, 2010 Author Share Posted May 11, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/201376-smartcard-reader-with-php/#findComment-1056591 Share on other sites More sharing options...
Mchl Posted May 11, 2010 Share Posted May 11, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/201376-smartcard-reader-with-php/#findComment-1056599 Share on other sites More sharing options...
chaiwei Posted May 11, 2010 Author Share Posted May 11, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/201376-smartcard-reader-with-php/#findComment-1056621 Share on other sites More sharing options...
Mchl Posted May 11, 2010 Share Posted May 11, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/201376-smartcard-reader-with-php/#findComment-1056641 Share on other sites More sharing options...
chaiwei Posted May 12, 2010 Author Share Posted May 12, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/201376-smartcard-reader-with-php/#findComment-1056916 Share on other sites More sharing options...
Mchl Posted May 12, 2010 Share Posted May 12, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/201376-smartcard-reader-with-php/#findComment-1057003 Share on other sites More sharing options...
chaiwei Posted May 12, 2010 Author Share Posted May 12, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/201376-smartcard-reader-with-php/#findComment-1057012 Share on other sites More sharing options...
Mchl Posted May 12, 2010 Share Posted May 12, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/201376-smartcard-reader-with-php/#findComment-1057018 Share on other sites More sharing options...
Mchl Posted May 12, 2010 Share Posted May 12, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/201376-smartcard-reader-with-php/#findComment-1057024 Share on other sites More sharing options...
chaiwei Posted May 12, 2010 Author Share Posted May 12, 2010 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] Quote Link to comment https://forums.phpfreaks.com/topic/201376-smartcard-reader-with-php/#findComment-1057249 Share on other sites More sharing options...
Mchl Posted May 13, 2010 Share Posted May 13, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/201376-smartcard-reader-with-php/#findComment-1057666 Share on other sites More sharing options...
chaiwei Posted May 24, 2010 Author Share Posted May 24, 2010 How about using PHP cli, is that possible to use php cli to communicate with webcam/smart card reader? Please advise. Quote Link to comment https://forums.phpfreaks.com/topic/201376-smartcard-reader-with-php/#findComment-1062528 Share on other sites More sharing options...
Mchl Posted May 24, 2010 Share Posted May 24, 2010 No difference. It's still (mostly) same API Quote Link to comment https://forums.phpfreaks.com/topic/201376-smartcard-reader-with-php/#findComment-1062531 Share on other sites More sharing options...
chaiwei Posted May 24, 2010 Author Share Posted May 24, 2010 Thank you Mchl. You really help me a lot. Quote Link to comment https://forums.phpfreaks.com/topic/201376-smartcard-reader-with-php/#findComment-1062535 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.