Jump to content

function ping($host)?


dexterbb

Recommended Posts

Hey guys,

 

I'm trying to show a few ips are online or not, but the return is always as online. The function I'm trying to use is the one below:

<?php
function ping($host) {
	$conectado = fsockopen($host, 80, $numeroDoErro, $stringDoErro, 255);
	if ($conectado) {
		return true;
	}else{
		return false;
		fclose($conectado);
	}
}
?>

The variable $host receives an ip like this: 172.16.10.50

 

I'm calling the function like this: $ping = ping($dados[ip]);

 

I need some extra configuration to work properly?

Link to comment
https://forums.phpfreaks.com/topic/277463-function-pinghost/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.