questo č il codice che ho usato io:

Codice PHP:

<?php

function getIPStatus($ip,$port){

        if(
$check=fsockopen($ip,$port,$errno,$errstr,2))
        {
                
fclose($check);
                return 
"online";
        }else{
                return 
"offline";
        }

}


echo 
"the ip is: ".getIPStatus("10.8.123.21",80);

?>
e funge correttamente... sei sicuro sicuro che dalla macchina da cui effettui i test gli ip che testi siano "irraggiungibili", ovvero che al ping rispondono Host unreachable?