How to connect your mobile to localhost ?

There are times when one do not know what to search for? I know my problem but I do not know what to type on google. I end up with wasting a lot of time when I got to know about this.

You are developing an application, you have tasted it on pc with apache server (xampp, lamp or wamp) then you want to test it on your smartphone. Or you want totest your responsive website to test on phone. But you do not have any way to insert or fetch data from localhost of your pc. Now what?

Answer is not much complecated. You just need to follow these steps :

  1. Open command prompt(Windows) or Terminal (linux). In linux you just have to press keys  – CTRL+ALT+T
  2. Now in your terminal, type

$ ifconfig

1stblog

 

 

3. Here you can see in 3rd line that there is a inet addr

inet addr:192.168.12.1

4. Use this inet address  in place of localhost.

5. Connect your phone and pc to same wifi network.

6.Here you go. You can test your app on phone with little effort.

If any problem occurs, let me know.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s