I want to connect to my localhost using my smart phone through WiFi.
I got my IP via www.whatismyip.com, and got my smart phone to connect to my laptop successfully.
However, when I type localhost
as the web address in the browser of my phone, nothing shows up.
How can I access localhost/index.php
page through my smart phone?
Are you sure that your pc and phone in the same lan?
Your phone can access first, because you use public network ip. I guess you can not access by using localhost ip, because they are not in the same lan.
The easiest would be to upload your source to a server that accessible through the internet and get the hosts ip address and try to load it on the smart phone.
If you want to access your app from your laptop you need to figure out what is your ip on your laptop then access your localhost.
Make sure you stay connected to the wifi on your smartphone.
1) Install a proxy server on your laptop (for example FreeProxy) don't run it yet!
2) Get the local ip of your laptop (the one used inside your network, given by your wifi router) by running Start -> cmd -> ipconfig.
Look for a line like:
Wireless LAN adapter Wireless Network Connection
And under it you need the value fromIPv4 Address
. The IP should be something like: 10.x.x.x or 192.168.x.x Copy this IP address, you will need it for the next step.2) Edit the hosts file on your laptop (c:\windows\system32\drivers\etc\hosts), you will need administrator permissions to edit this file. add a line into this file like:
10.0.0.1 laptop
Now, the 10.0.0.1 should be replaced by the local IP of your laptop (obtained at step #2). Save the file.
3) Run the proxy server.
4) Configure your smarphone to use the proxy server (this is smartphone specific, which one do you have?).
5) In your smartphone browser type the address: http://laptop/index.php
use your laptop wifi connection ip instead of localhost like 192.168.50.2.