title: file_get_contents(): php_network_getaddresses: getaddrinfo failed
body: <p>I'm trying to update some values from one server to another server with a cron job. I use file_get_contents().</p>
  <p>The strange thing is that this fails occasionally. One minute it works, another minute it won't work.
  I receive these two errors:</p>
  <blockquote>
  <p>PHP Warning:  file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known</p>
  <p>PHP Warning:  file_get_contents(): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known</p>
  </blockquote>
  <p>and:</p>
  <blockquote>
  <p>PHP Warning:  file_get_contents(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname</p>
  <p>PHP Warning:  file_get_contents(): failed to open stream: php_network_getaddresses: getaddrinfo failed: No address associated with hostname</p>
  </blockquote>
  <p>I've logged into the server that experiences this problem. Using ping or traceroute works fine, so I've ruled out DNS issues. I've also added the google DNS nameservers just to be sure. A third server that uses the exact same code doesn't have this problem, so it looks to be a problem on the &quot;calling&quot; end, not the &quot;responding&quot; end. Replacing the hostname with IP is not an option for this case.</p>
  <p>Does anyone know how to solve this?</p>