Android tutorial: HttpUrlConnection connect web service PHP + MySQL and get return info




This video guides you step by step to create an android app to send request and get information (json) from web service PHP + MySQL using HttpUrlConnection: …

source


17 responses to “Android tutorial: HttpUrlConnection connect web service PHP + MySQL and get return info”

  1. hello,brother, thank you for your tutorial. I have a bug and i stuck at there, could u help me ?
    W/getJSONStringWithParam: Response Status = 200
    07-27 12:30:49.230 21531-21839/com.gnirt69.connectservicephpexam W/System.err: org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
    07-27 12:30:49.231 21531-21839/com.gnirt69.connectservicephpexam W/System.err: at org.json.JSON.typeMismatch(JSON.java:111)
    07-27 12:30:49.231 21531-21839/com.gnirt69.connectservicephpexam W/System.err: at org.json.JSONObject.<init>(JSONObject.java:160)
    07-27 12:30:49.231 21531-21839/com.gnirt69.connectservicephpexam W/System.err: at org.json.JSONObject.<init>(JSONObject.java:173)
    07-27 12:30:49.231 21531-21839/com.gnirt69.connectservicephpexam W/System.err: at com.gnirt69.connectservicephpexam.RegisterActivity$TaskRegister.doInBackground(RegisterActivity.java:72)
    07-27 12:30:49.231 21531-21839/com.gnirt69.connectservicephpexam W/System.err: at com.gnirt69.connectservicephpexam.RegisterActivity$TaskRegister.doInBackground(RegisterActivity.java:57)
    07-27 12:30:49.232 21531-21839/com.gnirt69.connectservicephpexam W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:292)

    By the way, I only changed your url address to my 192.168.0.13
    this JSON exception makes me mad.pls help me

  2. Great! This tutorial is helpful. I cannot find another tutorial which is better than this tutorial. When I use localhost inside XAMPP, it works. Then I tried to transform from localhost to free hosting web server (e.g. GearHost). I have registered the free hosting web server (I am using GearHost) and then I only changed $dbName, $user, $pwd, and $host in PDOConnection.php to fit the web server (I am using GearHost). When I put these PHP files on the web server (I am using GearHost) and create table through MySQL Workbench 6.3 CE as like as what I have done in XAMPP's PHPMyAdmin, it still works! You have saved me a lot of time. This tutorial makes me become more passionate about Android app development. Thank you very much.

Leave a Reply