I'm trying to ping the ip address to test the ip address whether it is available or not. But i having trouble on using the fsockopen function. I had do some research on using 'ping','exec' function but none of them seem really workable.
Here is my code to test the IP address:
<?php
$ipAddress = array("192.168.1.1","192.168.1.67");
$kiosk = array("Kuantan (35)","UTC Kuantan (36)");
$checkCount = 0;
foreach(array_combine($ipAddress,$kiosk) as $items => $kiosk){
$fp = @fSockOpen($items,80,$errno,$errstr,1);
if(is_resource($fp)){
if($fp) {
$status=0;
fclose($fp);
echo 'Success<br/>';
}
}
else{
echo 'Failed<br/>';
}
}
?>
Both the IP address i can ping from cmd prompt. But for 192.168.1.67 it lead me to 'Failed', only the 192.168.1.1. or 127.0.0.1 showing me 'Success'. Is there anything i do wrong?