Check internet connection with php
THEME
Hi, we do internet connection control with this article in PHP example.
How do i know if connect to the internet?
if 80th port returns true, know internet connection is successfully.
look at the example;
function is_connected()
{
$connected = @fsockopen("www.some_domain.com", 80);
//website, port (try 80 or 443)
if ($connected){
$is_conn = true; //action when connected
fclose($connected);
}else{
$is_conn = false; //action in connection failure
}
return $is_conn;
}
What does it do?
- Check internet or website connection
- internet based scripts for internet connection