+5 votes
543 views
by (3k points)
Hello !

As part of my training, I develop a project on Android where I have to retrieve information from a database. My problem is that I do not have a database "on line" and that I can only use Wamp so that I have to connect to localhost.

My question is: How can I access the localhost my PC from my Android phone (HTC Sensation)? First I want to connect to it via the browser to see if it works before trying something in my application and get bugs.

I tried to connect via the internet over and go to the address 127.0.0.1, which gives me an error ("Web Page Unavailable"). Accessing the IP address of my computer gives me an error "Forbidden" and I do not think I will find the solution by accessing the IP address of my phone. The only info I've found that might work would be to use the address 10.0.2.2 on the emulator to access the local loop of the PC but it does not change my problem because it does not work on my phone test.

I also want to clarify that I have to work on a virtual machine but it surprised me that the problem comes from there.

Thank you in advance for the help you can get me. I am sincerely sorry if I was wrong to post part of my subject.

Best regards

4 Answers

+3 votes
by

Smartphones are not (fully) computers. To gain access to your server via your local network, you must have the same network parameters (gateway, dns) and then put in the URL of the IP server.

You connect to 127.0.0.1 on your phone no sense at all, you do not have a web server on your Android ...

My answer to your original question: should you go see in the advanced settings Wifi whether it is possible to change the IP settings. Or perhaps an application proposes.

+4 votes
by

Hello,

Why look for noon to 14h. So as the saying Desolation 127.0.0.1 is the localhost address, if you do it on your browser such, it'll look as if the AC is the web server.

To access wamp that is on your pc since you such, uses the local ip of your pc provided that such tone is on the same network. Moreover it must change wamp config files to allow the connection from a different host localhost, that's why you find you with access prohibited since such tone.

Last solution, if this is on your 3g, you can still access your web server has, by cons must be some manipulation, you must configure your already server to accept connection from the outside, the next you redirects ports box on your pC that hosts the server, and then access while using your public address (the one you have when you're surfing the internet).

+5 votes
by (3k points)

Thank you for your answers, I'll look at how to fix it and I'll let you know!

Edit: I found the solution, I had to spend the Wamp server "online".

Thank you for your help !

+3 votes
by

Hello
I have the same problem, I want to run a php script from my android app I change the httpd.conf to accept remote requettes
I try to type in my IP address into a browser and works well, but quend I do that with my android application ca not.
thank you,

statcounter statistics counter
...