I would like to check the internet connection status using php. I tried this:
<?php
$connected = @fsockopen("www.google.com");
if ($connected){
$is_conn = true; //0
fclose($connected);
}else{
$is_conn = false; //1
}
echo (int)$is_conn;
?>
but it always returns true if I'm connected to the internal notwork! I need it to return false if I'm not online even if I'm connected to internal network.