android Php Mysql connection -
help please
i trying make login form using php , android.but problem in making connection between php mysql , android.
when use 127.0.0.1 ,php file accessible through browser on android cell says
connection refused , when use 10.0.2.2, php file not accessible through browser , on android cell says
connection timeout
here code
httpclient=new defaulthttpclient(); httppost= new httppost("http://10.0.2.2/my_folder_inside_htdocs/check.php"); // make sure url correct. //add data namevaluepairs = new arraylist<namevaluepair>(2); // use same variable name posting i.e android side variable name , php side variable name should similar, namevaluepairs.add(new basicnamevaluepair("name",et.gettext().tostring().trim())); // $edittext_value = $_post['edittext_value']; namevaluepairs.add(new basicnamevaluepair("password",pass.gettext().tostring().trim())); httppost.setentity(new urlencodedformentity(namevaluepairs)); //execute http post request response=httpclient.execute(httppost); // edited james coderzheaven.. here.... responsehandler<string> responsehandler = new basicresponsehandler(); final string response = httpclient.execute(httppost, responsehandler); system.out.println("response : " + response); runonuithread(new runnable() { public void run() { tv.settext("response php : " + response); dialog.dismiss(); } });
use ip address in httppost
httppost= new httppost("http://ipaddress/my_folder_inside_htdocs/check.php");
i think you
Comments
Post a Comment