Check Internet Connection using PHP

by satheeshkumar 2014-09-09 13:06:43

Code to check wheather your system is connented to internet or not using PHP,
 
<?php
function network_is_connected()
{
    $connected = @fsockopen("www.hiox.com", 80);  //use port number 80 or 443
    if ($connected){
        $is_conn = "connected"; 
        fclose($connected);
    }else{
        $is_conn = "not connected"; 
    }
    echo $is_conn;

}

echo network_is_connected();
?>
653
like
0
dislike
0
mail
flag

You must LOGIN to add comments