I want to be able to send a parameter to a php page that contains a devices IMEI/MEID.
I then want the php page to take that IMEI parameter and check a list of IMEI’s to see if the IMEI sent as a parameter from my Java mobile app is contained in a database, if it is then return true.
I only know the very basics of php but I believe this should be possible?
If so can anyone point me in the right direction of what php functions I should be looking into?
And also the best way to pass the parameter from java?
Yes, it’s perfectly possible. You don’t pass parameters to php functions. Instead of that, you use HTTP protocol to execute php scripts.
You need to execute a
GETHTTP command from your mobile device like this:In your PHP script, you will have something simple like:
Your PHP script will reside in your application server (Apache with MOD_PHP). Refer to Apache’s documentation to setup it with PHP support, and to learn where to place the script. You will have to add the DB part. There are lots of examples you can find on the internet (even in StackOverflow) to learn how to connect to a Database with PHP. They all depend on what database you connect to, so when you search (or ask in StackOverflow), make sure you specify what DB you are connecting to.
To invoke remote HTTP commands with Java ME you can use HttpConnection interface.
You will use something like: