Skip to main content

Website uptime monitoring using PHP script

This post explains about website monitoring. My friend Vidhi made simple script to get the your website uptime. Using this script we will get information about your websites. If we have more number of websites then it is an awesome tool to monitor your websites.
Website uptime monitoring using php script by Anil Labs
Website uptime monitoring using php script by Anil Labs
We have the basic need to check weather the our website is working fine.Sometimes due to issues by the Hosting servers,Website goes DOWN. At that moment owner should aware of that the Website goes DOWN so that Owner can take the right action at the moment OR he/she can direct contact to the Hosting server company.
But for that we need to check the website status every time.So We can run such script at given period of time (ie. 5 Minutes,10 Minutes) and It checks the website status every time.It will mail the owner if it founds that Site is DOWN.We can set the script using our cron job with decided period.

Tip : If you want to create such script then use the CSV method shown in demo.Follow the below steps :

1)You can create the thousands of entries of your website with their admin email id in your CSV file.

2)Create the cron job with every 5 Minutes and set the attached script.

3)Rename the CSV file in script with your CSV file.

4)Status messages of all your websites which are provided in CSV file will get mail using one of below links


How to add HTML content in php mail() function
Sending mail using phpmailer and gmail as smtp
How to send mail using phpmailer class
Rest will taken care by the script.Admin will notify as soon as the Site will goes DOWN.

Sample code

function url_status($url) {
    $handle = curl_init($url);
    
    curl_setopt($handle,  CURLOPT_RETURNTRANSFER, TRUE)
        
    curl_setopt($handle, CURLOPT_TIMEOUT, 10);

    $response = curl_exec($handle);
        
    $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
        
    curl_close($resource)

    return $httpCode == 200; // 200 =  STASUS OKIE

Comments

Popular posts from this blog

Learn phpfox

PHPFox  is a social network script, it is an internet application and when you install it, it is a website. The  phpfox  script comes in 3 packages, each with a different set of modules. it has two products: 1. Nebula (upto phpfox 3.8) 2. Neutron (Newer) You can check the demo on :  http://www.phpfox.com =================================================== To clear cache in phpfox follow the following steps, admincp >> Tools >> Maintenance >> Cache Manager >> Click on Clear All button =================================================== To work facebook app on local Following settings need to done in facebook app   1) go => setting => Advance 2) see "OAuth Settings" area and set "Valid OAuth redirect URIs" =  http:// projectdomain /index.php?do=/user/login/, http:// projectdomain .com/index.php?do=/user/register/, http:// projectdomain .com, http:// projectdomain .com/index.php 3) en...

Interview PHP

>> Why do you want to work at our company? Sir, It is a great privilege for anyone to work in a reputed company like yours. When I read about your company I found that my skills are matching your requirements.  Where I can showcase my technical skills to contribute to the company growth. >> What are your strengths? I am very much hard working and optimistic. Hard Working: Work with dedication and determination. Optimistic: work with positive attitude. I am a team player. I am also very hardworking, and will do what it takes to get the job done. >> What are your weaknesses? Gets nervous when talk to strangers I am a bit lazy about which I am not interested I tend to trust people too easily. I am working on it. >> Why should I hire you? With reference to my work experience, I satisfy all the requirement for this job. I am sincere with my work and would never let you down in anyway. I promise you will never regret for the decision to a...

How to Make Your Own PHP Captcha Generator

In this article we will create file based simple yet successful captcha generator. 3 Major Anti-spamming techniques used? Mathematical Operation like Random number + Random Number = -> The user must specify the answer Random word -> User must type the word Random question -> Obvious one which the user should answer correctly [ex: Are you human?] How Captcha works? The captcha generator generates an IMAGE with the question and then put up a session variable storing the value. User input though an input box. Using php POST, we compare the session variable data with the user input and tell whether its a bot or human. Its coding time The Code First let's write the php script which generates the captcha image. We use the simple header-content change technique, from which we can easily bring up an image from a given text. captcha.php PHP Code: array("Num" => "Num"), 1 => array("Are y...