Check internet connection with php

Check internet connection with php

Check internet connection with php

determine in php script is connected to internet

Check internet connection with php

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

İlgili kelimeler;
check internet connection php
İlgili kategori;
PHP Dersleri
Makaleyi paylaşın; Google+FacebookTwitterTumblrPinterestLinkedIn

Benzer makaleler mi eklemeliyim ? Bana LinkedIn ve Github adreslerimden üzerinden ulaşabilirsiniz.