How to connect an Android client to a local Apache server (php) inside my laptop?

I am trying to create Android applications that can send data via a Wi-Fi connection to my Apache Server laptop and MySQL database. I am using the Samsung Galaxy Tab 10.1 as my mobile device. and the protocol used is HttpGet or HttpPost. And I use XAMPP (with Apache and SQL) to make the server and handle php. But due to the fact that Android cannot detect the adhoc network from the laptop, I use the Virtual Router (for window 7) to create a virtual access point and make it possible to connect the tablet to my laptop. But the problem is this:

  • In my applications (client-android), where is the httpget or httppost to which the url belongs? localhost in my laptop 127.0.0.1 or localhost in android 10.0.0.1? or the IP address of the virtual router?

  • So, if I want to access from android to localhost (laptop-Apache) in order to call php to run? which port? which is ip address / url that i need to add to android apps (httpget)? and do I need to change something in httpconfig for XAMPP?

+8
android php apache client-server xampp
source share
2 answers

Find out your IP address on your laptop using ipconfig. use this address on your phone instead of 127.0.0.1.

0
source share

if you know the IP address of the computer with Apache on it, since external access to MySQL is quite difficult to configure the identifier, it is recommended to send JSON requests to your PHP scripts and get the return value through Java, and then what do you want to do with the output before you.

0
source share

All Articles