Ping a url

SpaceshipSpaceship
SpaceshipSpaceship
NamecheapNamecheap
Watch

edmarriner

Established Member
Impact
4
is there anyway or waebist to basicly ping the url say every 30 mins?

thanks

ed
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
0
Close
Hey Ed,

Here's what we'll do. Assuming you have access to the ever ample PHP, crontabs and access to shell_exec(), we'll begin.

The following is a script that will run the ping, and return a result.
PHP:
<?php
/* 
Script written by Steve Castle (http://www.stscac.com)
Modified from http://shat.net/php/nqt/nqt.php.txt

For the purpose of this example, the filename of this file (PHP_SELF) will be named ping.php and located in server path erver/path/to/script/

The "$domain" variable is the domain name you are going to be checking.  Use  the domain name without the protocol.
(Good = namepros.com, Bad = http://www.namepros.com)
*/
$domain = "namepros.com";
function message($msg){
echo "<font face=\"verdana,arial\" size=1>$msg</font>";
flush();
}
function ping($domain){
message("<p><b>Ping Results:</b><blockquote>");
if (! $msg .= trim(nl2br(`ping -c5 '$domain'`))) #bugfix
  $msg .= "Ping failed. Host may not be active.";
$msg .= "</blockquote></p>";
message($msg);
}
ping($domain);
?>
The following is the crontab that needs to be added to your server, so the PHP script above can be run every 1/2 hour.
Code:
30 * * * * server/path/to/script/ping.php

This only checks the results every 30 minutes. To report the results, you would have to email them or add them to a database.

Hope this starts you off in the right direction.

Cheers B-)!

-Steve
 
0
Close
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back