ecommerce website design Shropshire, Custom & Ecommerce Website Designers, Web Page Design Company Shropshire UK Site Map
Phone:01743 272 609 Fax: 0709 286 1166
Home page, website design service at Shrewsbury, Shropshire. We supply website design service to business in Shropshire and whole UKAbout spark computing, website design service at Shrewsbury, Shropshire. We supply website design service to business in Shropshire and whole UKExpertise and services from spark computing, website design service at Shrewsbury, Shropshire. We supply website design service to business in Shropshire and whole UKOffice automatic solutions, online business solutions supplied by Spark computing, shrewsbury, shropshirecontact spark computing, shrewsbury, shroshire to discuss online business websites, custom software development

Monitor if the remote host alive or not using PHP

04/05/10

Permalink 11:39:52 am, Categories: General IT articles  

Monitor if the remote host alive or not using PHP

The simplest way to find out if the remote host is alive or not is to use the ping utility. Pear provides such a convenient tool.

First, you need to install the right module

Code:

pear install Net_ping

Here is the php

PHP:

// include class
require ("Net/Ping.php");
 
// create object
$ping Net_Ping::factory();
 
// ping host and display response
if(!PEAR::isError($ping))
{
   $response $ping->ping('REMOTE_HOST_IP_or_name');
   //print_r($response);
   if( $response->_transmitted &&  $response->_received ==&& $response->_loss ==100)
   {
       mail("your email address""remote host  is not responding"date("Y-M-D H:i:s"), "From: your_email");
   }else{
    //server is OK
  }
 
}

The above code will send out email to you if the remote host is not responding. However, if the remote host is behind a firewall or if ping packets are blocked by firewall, the ping is not going to work.


Tweet this! Facebook Live Yahoo bookmark Digg US google bookmark

Trackback address for this post:

https://www.sparkcomputing.co.uk/blogs/htsrv/trackback.php?tb_id=62

Trackbacks, Pingbacks:

No Trackbacks/Pingbacks for this post yet...

August 2022
Mon Tue Wed Thu Fri Sat Sun
 << <   > >>
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

Spark Website Design, Shropshire

Technical articles on IT solutions.

Free information on office and home IT solutions; How to get a website running for your business; self-help e-commerce; and tips on website design.

Search

Misc

XML Feeds

What is this?