<?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(); ?>