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:
mail.domain.co.id
is the wrong name for your mail server- 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
Symfony2 Collection of Entities - How to Add/Remove Association with Existing Entities
Comparing Bcrypt Hash Between PHP and Nodejs
Cannot Call Function SQLsrv_Connect()
PHP File Uploads Doesnot Read $_Files['Image']
Display Single Column Value of MySQLi Query
Concatenate PHP Function Output to a String Like Variables
Check to See If an Email Is Already in the Database Using Prepared Statements
How to Create a Random Hash/String
A Script to Change All Tables and Fields to the Utf-8-Bin Collation in MySQL
Array Merge on Multidimensional Array
Email PDF Attachment with PHP Using Fpdf
How to Only Use Created_At in Laravel
PHP - Getsqlvaluestring Function
Changing the Add to Cart Button Text in Woocommerce for Items with Variations