Php_Network_Getaddresses: Getaddrinfo Failed: Name or Service Not Known

php_network_getaddresses: getaddrinfo failed: Name or service not known

If you only want to submit GET data to the URL, you should use something straightforward like file_get_contents();

$myGetData = "?var1=val1&var2=val2";
file_get_contents($url.$myGetData);

Getting connection failed: php_network_getaddresses: getaddrinfo failed: Name or service not known

My database is on the same machine so I just needed to edit:

$servername = "localhost"

Now everything is working just fine.

PHPMailer error php_network_getaddresses: getaddrinfo failed: Name or service not known

The answer is in the error message:

php_network_getaddresses: getaddrinfo failed: Name or service not known

This means one of two things:

  1. mail.domain.co.id is the wrong name for your mail server
  2. Your DNS service isn't working

This has nothing to do with your script, and everything to do with either your settings or your server's network.

ERROR: 0 - php_network_getaddresses: getaddrinfo failed: Name or service not known

Logical to me: the fsockopen() first argument $site is not set. I presume it should be $ip instead of $site.
By the way you should be careful as fsockopen() returns a ressource, when checking for it's return you should strict test.

public function check_ch($prt)
{
$ip = "xx.xx.xx.xxx";

$fp = @fsockopen($ip, $prt, $errno, $errstr);
if ($fp === false) {
// return $port;
return "ERROR: $errno - $errstr<br />\n";
} else {
return 1;
}
}

EDIT:
When you silence a function with a @, if you get a problem, the first reflex to have is to unsilence it. You should have a report that $site is not set if it was unsilenced ;)



Related Topics



Leave a reply



Submit