Click here to Skip to main content
15,901,982 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Guys, I have created my application in android which perform validation task in its first page .i am sending the parameters through php file which is stored in my xampp/htdoc/android_connect folder. right noe my laptop is my server only .when i run my application in android emulator with local area connection it works fine.but when i run it in on my tablet which is connected to my wifi and my laptop is also connected to wifi it does not calling that php file please give me some solution to run it properly.i will be so thankfull to you..please help me...please .

laptop ipaddress when i connect it to wifi is
192.168.1.101
and my tablet ipaddress is
192.168.1.103

in my android code i am using this:::to post on server

C#
httpclient=new DefaultHttpClient();
           // httppost= new HttpPost("http://192.168.32.203/android_connect/check.php");
           httppost= new HttpPost("http://192.168.1.101/android_connect/check.php");
          //  httppost= new HttpPost("http://192.168.137.1/android_connect/check.php");
            //httppost= new HttpPost("http://192.168.32.203/android_connect/insert.php"); // make sure the url is correct.
            //add your data
            nameValuePairs = new ArrayList<NameValuePair>(3);
            // Always use the same variable name for posting i.e the android side variable name and php side variable name should be similar,
            nameValuePairs.add(new BasicNameValuePair("username",et.getText().toString().trim()));  // $Edittext_value = $_POST['Edittext_value'];
            nameValuePairs.add(new BasicNameValuePair("password",pass.getText().toString().trim()));

            nameValuePairs.add(new BasicNameValuePair("type",agent.getContext().toString().trim()));
            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
            //Execute HTTP Post Request
            response=httpclient.execute(httppost);
Posted
Comments
Pratik Butani 12-Aug-13 2:23am    
Have you check this url in browser?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900