Trying to get information from an external source, I\'m receiving the following error:
Warning: php_network_getaddresses: getaddrinfo
In the following httpd.conf
file, configure the ServerName
properly.
/etc/httpd/conf/httpd.conf
Like below:
ServerName 127.0.0.1:80
or
ServerName sitename
This resolved similar issue I was facing.
Although I didn't use this exact function I got this same error.
In my case I just had to remove the protocol.
Instead of $uri = "http://api.hostip.info/?ip=$ip&position=true";
Use $uri = "api.hostip.info/?ip=$ip&position=true";
And it worked fine afterwards
I faced a similar issue on Docker for Ubuntu. It's a DNS issue. You will have to add Google Public DNS Settings into your network. Instruction for adding those settings is OS dependant. In my case, I was using Ubuntu so I added via network manager. Visit this site for more info.
It's because you can't resolve the host name Maybe DNS problems, host is unreachable...
try to use IP address instead of host name... ping this host name... nslookup it...
I would imagine that the caching DNS servers you're using aren't behaving properly (or the DNS server for the domain you're resolving isn't working properly). You can try to fix the former possibility.
Do you have at least 2 name servers registered on your network adapter? You could always swap your computer over to use a different caching DNS server to rule this out. Try Google's:
8.8.8.8
8.8.4.4