I cannot repeat this using the code above - namelookup_time on my (Windows) machine returns as 0 , with total_time being ~ 0.5 . namelookup_time is the time that the OS took to resolve the DNS name for whatismyip.org , so you need to check the DNS configuration of your server.
Assuming your configured primary DNS server does not exist / does not work, and the timeout is 10 seconds. This means that the OS will wait 10 seconds, trying to contact the primary DNS, and when this time fails on the secondary, which works.
What are your configured DNS servers? Try using 8.8.8.8 (Google) as your primary DNS, if necessary.
As a side note, it is best to specify the full URL for cURL, so use http://whatismyip.org/ instead of just whatismyip.org - although this does not seem to be the cause of this particular problem.
source share