Trying to get information from an external source, I’m receiving the following error:
Warning: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in line #…
Yesterday everything was fine, so what happened to this script, which is not working and gives me the error above? Any solution or hint to solve this problem?
$uri = "http://api.hostip.info/?ip=$ip&position=true"; $dom->load($uri);
I also tried by converting DNS to IP but then I get the warning:
failed to open
$uri = "184.108.40.206/?ip=$ip&position=true";
I tried to remove the
http but am still getting the above error.
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…
In the following
httpd.conf file, configure the
This resolved similar issue I was facing.
In my case(my machine is ubuntu 16), I append
/etc/resolvconf/resolv.conf.d/base file by adding below ns lines.
nameserver 220.127.116.11 nameserver 18.104.22.168 nameserver 2001:4860:4860::8844 nameserver 2001:4860:4860::8888
then run the update script,
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:
If you can discount transient outages on the remote server you are trying to connect to, then that just leaves the local network config as a problem.
Using the IP address instead of the hostname is only going to work for the default domain on the remote host.
What happens when you try using www.google.com (or its IP address)? If you stil can’t connect, then its something to do with the network between your server and the outside world.
Although this is a old thread, I have come across the same error recently while running nslookup in CentOS 7 and google search led me to some of the discussions in SO including this one. However, adding the nameservers entries to /etc/resolv.conf alone did not help as the nameserver values in resolv.conf were overwritten by the NetworkManager with the default DNS nameservers that are in the eth profile associated to the ethernet IP config.
As mentioned by @m-canvar, set the following entries in /etc/resolv.conf
search yourdomain.com nameserver 22.214.171.124 nameserver 126.96.36.199 nameserver 188.8.131.52
To prevent overwriting these entries by NetworkManager, there are two two approaches:
Option 1: Either set NM_CONTROLLED=no in the eth profile associated to the IPv4/IPv6 profile.
Option 2: Disable NetworkManager service from running.
chkconfig NetworkManager off service NetworkManager stop
More details can be referred in my post about this error and solution.
Although I didn’t use this exact function I got this same error.
In my case I just had to remove the protocol.
$uri = "http://api.hostip.info/?ip=$ip&position=true";
$uri = "api.hostip.info/?ip=$ip&position=true";
And it worked fine afterwards
In my case this was being issued by
wp cli, and the problem was that I didn’t have
php7.3-curl installed. Fixed with:
apt-get install -y --quiet php7.3-curl
I think that you should try replacing php7.3-curl with api.hostip.info/?ip=$ip&position=true . Hope this helps