I am making an Android Application using GCM. I am trying to register through my app running on phone, the inputs are not able to store on localhost XAMPP using php. My phone and laptop are running on the same network. There is some problem with the ip address of localhost. I am using this url for saving on local host, where 192.168.43.247 is the ip address when pc is running with the help of phone's 3G network.
192.168.43.247/gcm_server_php/register.php
Please help!
Open Xampp>apache>conf>http-conf file in notepad.
Find Listen 80 and comment out using #(like #Listen 80) and write below it: Listen (static ip address of server):80
eg:
Listen 192.168.1.34:80
If you want to use your application on emulator with localhost database(Xampp) then you have to use the IP address 10.0.2.2 instead of other local ip address .. if you want to use your aap on mobile then you you can use same ip .. press up arrow on left side if my answer is usefull for you
try to check by disabling firewall or use ipconfig /all command then get your ip from there and use this ip as server ip address.
If still facing error then it might be error of your local server the request may be block or something else that you need to find out.to check it try to open url in your android mobile browser.
Related
I started a server inside my PC and when I want to visit localhost with a browser I have to write
localhost:8080
When I am trying to enter in the site with another PC or Phone through WIFI I have to write something like:
192.168.0.123:8080
My question is, is there any way I can enter inside the site I am hosting inside my PC without writing the port, like:
192.168.0.123
(N.B. : I just want to use this inside my wifi network. Going public is not my target)
With http, unless the port is 80, you have to specify it.
So you'll have to configure your server to use port 80 instead of 8080.
I have setup WAMP on my computer and have created a PHP web service which is located at this URL
http://localhost/WebService/?mode=get
I am using Android Studio and running the project on my Nexus 5 phone. Both the development computer and my phone are connected to the same wifi network.
When I try and call that URL from the application I get an error:
Caused by: java.net.ConnectException: failed to connect to /127.0.0.1 (port 80): connect failed: ECONNREFUSED (Connection refused)
In my manifest I have the internet permission.
How can I access a local web service from my attached phone for dev/debug?
Emulator uses a special ip address to access the host machine local host. Use this link
http://10.0.2.2/WebService/?mode=get
In some cases you might have to assign a port other than default.
Check your URL from your emulator or from the device... if you are not able to access it, Find the right url....
Open command prompt->type ipconfig-> Get IPV4 address.... something like 192.xx...
So your URL is "http://192.xx.xx.xx/WebService/?mode=get"
To access your local host from your android emulator Use the ip address given in ipconfig.
It might be best to use
machine_name.local
as the host name, as your server/computer could change IP address if you are using DHCP
I'm trying to create a live web server on my Windows 8.1 computer.
I am connected directly to my modem using ethernet (I do have a wireless router) but I am not connected to it on this computer (desktop).
I have XAMPP working and my website appears at http://localhost/home
However, if I put in my IP from www.whatismyip.com it does not load my web server.
What am I missing?
You need to create a Port Forwarding for Port 80 to your Computers local IP Address. There should be a Admin Panel for your Router (normally the Gateway - check out with Start - Run - cmd -> then insert "ipconfig" and check out the Gateway.
And i guess in XAMPP the Internet Access is blocked. But this is a simple Apache Server, so you need to open your httpd.conf File (Should be: “c:\xampp\apache\conf\extra\httpd-xampp.conf)
Search here for:
There should be a "Deny from all" - add a # in Front to deactivate that rule.
Restart your Xampp and it should work.
Here you find more Information about Port-Forwarding:
https://managewp.com/how-to-access-a-local-website-from-internet-with-port-forwarding
Any maybe you will also need to activate Port 80 on your Firewall (depends on your Configuration)
You need a method of telling request sent to your public ip to be forwarded to the private ip of the web server. Try logging into you device (router etc) and setting this up.
I am unsure of what url to use for my application to connect to my WAMP server on local host.
Currently I am using:
String link = "http://10.0.2.2/login.php?username="
Is this correct or is should it be something else?
e.g.:
String link = "http://localhost/login.php?username="
None of them, first open cmd to find out your computer ip by command ip config and then go to firewall and enable port 80 listening and use that ip address.
look at this :
http://josephshaaia.wordpress.com/2012/12/22/connecting-android-device-to-a-database-on-mysql-wamp-server/
I am trying to write a small script that prints ip of the client. I am trying to run it on my localhost, but I am not able to get the IP address. Instead I get something like ::1.
Here's the code:
<?php echo $_SERVER['REMOTE_ADDR'];?>
Why this is not working as expected?
::1
Is the loopback adress (127.0.0.1 in IPv4) in IPv6.
This is the expected behaviour. If you use Firefox, you can navigate to about:config, search for disableIPv6 and set it to true. You'll then see 127.0.0.1.
So yes, it's working.
It is working correctly. That is your IP addresses... the IPv6 version of it. If you had connected over IPv4 it would have shown as 127.0.0.1.
These are loopback addresses. They allow you to connect to your own computer without using an actual network interface. See http://en.wikipedia.org/wiki/Loopback#Virtual_network_interface