I'm still new in programming and my situation is:
I want to do a webpage connect to MySQL by using php
How I read the data from card reader in this way? By using php also?
And how I format or read the data from the card? And then it is necessary for me to get card reader which has SDK so that I can read the data from the card?
A PHP web application's code is typically executed on the server side, so if you want to interact with a smartcard reader on the client side, you will need to use something else besides PHP code to access that client-side hardware. There are different possibilities on how to perform such access:
You could develop/use a Java applet embedded into the web page -- this is what most web applications do at the moment. If the smartcard reader is PC/SC-compliant, you could use the Java SmartcardIO API within that applet to access the reader and forware information to your PHP application on the server.
Another option could be a client-side application (you would need to create and provide that application) that acts as a web server itself and processes JSON (or whatever) GET/POST requests. That client-side application would then access the smartcard reader and your web application's (Java) script code could send JSON (or whatever) requests to it to retrieve card data.
Instead of a client-side stand-alone application you could also create a web-browser plugin (again, you would need to create and provide that plugin). That plugin could then act as a proxy between your web-application and the smartcard reader.
You must use this library
PC/SC for PHP5
And install the php extension for PC/SC https://pecl.php.net/package/pcsc
But you need to install an older version of Laravel to use PHP5, the library is not compatible with PHP 7
Related
I have a web application that uses jQuery (via ajax) to PHP and from there to a MySQL database.
I need to do some ML using Python and reading from the database. My problem is that I am unable to figure out how to communicate from PHP to Python and back to PHP?
For more context, this will be a food recommendation system so on the website, if the user wants recommendations they can select filters (e.g. price range). Now at the moment, this will send a request to PHP and I am trying to pass data to Python run the recommender and get back to PHP with the returned data. Or is there a better way to do this? Like communicate from jquery to Python straight away. (I have Python running the recommender by itself communicating with the database, it just needs the filters that are in jquery)
You could use something like WebSockets to communicate from your front end to the Python backend. WebSockets are basically elevated HTTP sessions which allow for bidirectional transmission.
Mozilla docs have great information on WebSocket API that's built into modern browsers.
Here
This would be if you wanted to communicate straight from the front-end to python. If you wanted to do it from the backend (php), you could establish a socket connection from php to your python program. (TCP). But this might a bit overkill.
Maybe as a simpler alternative, you could create a small Flask web application with an endpoint that can be called by your PHP application (using an HTTP client).
The Flask web app can then make use of all regular Python functionality such as the ML libraries you require and return the result to your PHP application.
Or call the service directly through an ajax request.
I have a website that uses MySQL database.
I'm trying to build an iOS app for it, so I wanted to use Swift to import information from the database and insert new information to it. I read that for the reading part I should use a PHP file to create a Json file, read that and extract the data. But I can't find the way to do it with swift.
Is there a way to connect iOS apps (written in Swift) to MySQL?
In the client-server architecture, the client is completely separate from the server, and they just exchange data thanks to a common "language" (in your case, certain fields encoded in JSON).
Your client is your iPhone app, written in Swift (but that's irrelevant).
You now need to build a server, which is entirely separate from the app. You don't need Swift for that. You will need a server (for example a cheap cloud VPS on Amazon EC2, Rackspace Cloud Servers, Microsoft Azure...) and you will have to create another application that runs on that server.
If it's just to pull data from a MySQL database, you can easily make that in PHP. Or you could use Node.js (which uses JavaScript: it's among the "trendiest" technologies at the moment), Ruby, Python, etc.For an example that uses PHP, you can check: https://stackoverflow.com/a/22367600/192024
To read the JSON data in your iOS app, then, you can use the builtin libraries: https://developer.apple.com/library/ios/DOCUMENTATION/Foundation/Reference/NSJSONSerialization_Class/index.html (it's available in Swift too)
I don't know what your app is doing, but if you want to ignore all the things with the backend (the server) you can always consider something like Parse Core and let somebody else take care of the backend.
I want to develop a web application to read data from a MIFARE chip card. The idea is for a program of fidelization for a shop.
Is possible to read the data from within a browser? How could this possibly work?
A PHP web application's code is executed on the server side, so if you want to interact with a MIFARE card (through a contactless smartcard reader) on the client side, you will need to use something else besides PHP code to access that client side hardware.
Your web application will also consist of a web page (HTML, CSS, (Java) script) that is displayed and executed on the client side. This web page could, for instance, contain script code that is executed within the client web browser.
There is the upcoming NFC Web API to access client-side NFC hardware (that could possibly be used as MIFARE card reader), but this API is not yet available in most (any?) web browsers and it would only allow access to NDEF data on NFC tags. So you would need to use the MIFARE card as NDEF tag.
An alternative could be a Java applet embedded into the web page -- this is what most web applications do at the moment. If the MIFARE card reader is PC/SC compliant, you could use the Java SmartcardIO API within that applet to access the reader.
Another option could be a client-side application (you would need to create and provide that application) that acts as a web server and processes JSON (or whatever) GET/POST requests. That client-side application would then access the MIFARE card reader and your web application's (Java) script code could send JSON (or whatever) requests to it to retrieve card data.
Is there any way to convert JAX-RPC to JAX-WS web service. The issue is we need to generate a client of this PHP based web service in java. The web service is written in PHP in RPC style, and when java team try to generate the client it get error "Selected wsdl is rpc encoded. You must select JAX-RPC Client" so we are requested to change the encoding style from RPC to WS can any one help in this regard
EDIT
Here is a plugin for netbeans that allow user to generate java based jax-rcp client. but as pre client requirement we need to change the web service. That is why need that.
Thanks in advance.
I want to connect a MySql DB with my android application.
However, I DON'T want to/CAN'T use PHP for doing this.
Almost all solution for MySql connection with android on internet uses PHP.
I read somewhere that, If one don't want to use PHP then web service should be used.
But I'm not able to find any tutorial/sample example for the same.
Any help appreciated.
It seems you're mixing up some things.
A web service is simply some code on the internet (web) which allows you to receive and send information to a server, where it is saved per example in a database.
PHP is just a language, in which you can write a web service.
You can use a vast array of languages to create a web service ( read: expose your database) to other devices. Among others, you can easily do this in Java, .NET, Python ...
If you're looking for a way to connect to an external database without any web service / API in between, i'll have to disappoint you with the news that this is not supported by Android.
Most examples of a simple web service / a bunch of scripts contain PHP since this is probably the easiest and can be used on pretty much any server.
A webservice, is as it's called, a service, meaning that you have one side consuming it (the android client). if all you want is a persistent storage, you could use SQLite which is an SQL compliant solution which exists within android.
If it's possible to SSH to a server via Android, you could use that to connect to mysql, because the only other solution involves having mysql binaries installed locally on your android machine, and that's not possible AS FAR AS I KNOW, on Android.
One major reason for using a webservice (e.g. written in PHP) to connect to a remote DB is that you don't want to store the database login credentials inside your app. Because otherwise it'll be easy to extract your login for that database and access and edit it in a way you might not have planned (eg. delete stuff).
Its Possible to connect mysql database .
I have done with out using php file . I have used an spring configuration file to establish an connection to the database and dao to access the data from the database.
Create an Web Application that access the Server through the Spring Framework and an Servlet .
Create an Android Client Application tat make an get / post request to the Servlet , process the results in the servlet and return the response to the Android Client Application (json format ) Process the json format reponse in the Android Client Side and use it to your application