How to connect android client to the localhost of Apache server (php) inside my laptop?
Asked Answered
H

2

9

I'm trying to create android apps which able sending data through wifi connection to my laptop Apache Server and MySQL database. I use the samsung galaxy tab 10.1 as my mobile device. and the protocol i used is HttpGet or HttpPost. And i use XAMPP( with Apache& SQL) to do the server and process the php. But, due to android cannot detect adhoc network from laptop, i use Virtual Router ( for window 7) to create virtual access point and make the tablet able connect to my laptop. But the problem is:

  1. In my apps (client-android), where the httpget or httppost to which url? localhost in my laptop- 127.0.0.1 or localhost in android 10.0.0.1? or the ip address of the virtual router?

  2. So, if I want access from android to the localhost(laptop-Apache) to call the php to run? which port? which ip address /url that i need to put in android apps(httpget)? and do I need to modify anything in httpconfig for XAMPP?

Herdic answered 16/11, 2012 at 1:6 Comment(0)
W
1

Find out your Ip address in your laptop using ipconfig . use that address in the phone instead of 127.0.0.1.

Wendellwendi answered 16/11, 2012 at 3:49 Comment(0)
D
0

as long as you know the I.P Address of the Computer with Apache on it , Since external MySQL access is quite tricky to set up id recommend sending JSON requests to your PHP scripts and getting the return value via Java then what you want to do with the output is upto you.

Deaden answered 24/11, 2015 at 22:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.