- Joined
- Jan 19, 2007
- Posts
- 2,207
- Reaction score
- 47
A few weeks ago I didn't notice that one of my site's went down. It was down for 3 weeks. I was busy and didn't check it.
It went down for me not paying a renewal for a domain that I wanted to expire. The registrar changed the DNS on all domains in the account (I guess because of non-payment although I hadn't had notification because there was an old email on the account).
Basically, I wasn't on top of things and I got screwed. The website that was down for 3 weeks has of course been killed by Google. It was on the first page bringing in about $100 of affiliate income a month....
So since I found out I wanted to create a script (on a webpage) that will be my homepage and tell me if my sites are running ok.
I'm sure it can be improved (design/accuracy). There may be false negatives. I've pasted it below as it might help some people keep an eye on your sites.
basically copy and paste the code below into a new file (call it something like sitecheck.php) then upload it to your a single site. You can then access the status of your websites by going to your domain.com/sitecheck.php
You should of course change the websites in the code to your websites and also delete the related lines of code if you have fewer than 31 sites (or add more, if you have more)
It went down for me not paying a renewal for a domain that I wanted to expire. The registrar changed the DNS on all domains in the account (I guess because of non-payment although I hadn't had notification because there was an old email on the account).
Basically, I wasn't on top of things and I got screwed. The website that was down for 3 weeks has of course been killed by Google. It was on the first page bringing in about $100 of affiliate income a month....
So since I found out I wanted to create a script (on a webpage) that will be my homepage and tell me if my sites are running ok.
I'm sure it can be improved (design/accuracy). There may be false negatives. I've pasted it below as it might help some people keep an eye on your sites.
basically copy and paste the code below into a new file (call it something like sitecheck.php) then upload it to your a single site. You can then access the status of your websites by going to your domain.com/sitecheck.php
You should of course change the websites in the code to your websites and also delete the related lines of code if you have fewer than 31 sites (or add more, if you have more)
PHP:
<?php
echo 'Checking sites...<br />';
function Visit($url){
$agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";$ch=curl_init();
curl_setopt ($ch, CURLOPT_URL,$url );
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch,CURLOPT_VERBOSE,false);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch,CURLOPT_SSLVERSION,3);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, FALSE);
$page=curl_exec($ch);
//echo curl_error($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if($httpcode>=200 && $httpcode<300) return true;
else return false;
}
$url1 = "http://www.google.co.uk/";
$url2 = "http://www.msn.com/";
$url3 = "http://www.bbc.co.uk/";
$url4 = "http://www.acorndomains.co.uk/";
$url5 = "http://www.yahoo.co.uk/";
$url6 = "http://www.domain.com/";
$url7 = "http://www.website.co.uk/";
$url8 = "http://www.hello.co.uk/";
$url9 = "http://www.wowee.co.uk/";
$url10 = "http://www.cnn.info/";
$url11 = "http://www.egg.com/";
$url12 = "http://www.starbucks.com/";
$url13 = "http://www.apple.co.uk/";
$url14 = "http://www.domainlore.co.uk/";
$url15 = "http://www.yourdomain.com/";
$url16 = "http://www.bored.org.uk/";
$url17 = "http://www.i.co.uk/";
$url18 = "http://www.am.co.uk/index.php";
$url19 = "http://www.just.com/";
$url20 = "http://www.blanking.co.uk/";
$url21 = "http://www.out.com/";
$url22 = "http://www.my.com/";
$url23 = "http://www.domains.org/";
$url24 = "http://www.from.com/";
$url25 = "http://www.this.com/";
$url26 = "http://www.list.org.uk/";
$url27 = "http://www.of.com/";
$url28 = "http://www.websites.co.uk/";
$url29 = "http://www.bye.co.uk/";
$url30 = "http://www.for.org/";
$url31 = "http://www.now.com/";
if (Visit("$url1")) echo "<a href='$url1'/>$url1</a>"." OK"."<br />"; else echo "<font color='red'>$url1 DOWN</font>"."<br />";
if (Visit("$url2")) echo "<a href='$url2'/>$url2</a>"." OK"."<br />"; else echo "<font color='red'>$url2 DOWN</font>"."<br />";
if (Visit("$url3")) echo "<a href='$url3'/>$url3</a>"." OK"."<br />"; else echo "<font color='red'>$url3 DOWN</font>"."<br />";
if (Visit("$url4")) echo "<a href='$url4'/>$url4</a>"." OK"."<br />"; else echo "<font color='red'>$url4 DOWN</font>"."<br />";
if (Visit("$url5")) echo "<a href='$url5'/>$url5</a>"." OK"."<br />"; else echo "<font color='red'>$url5 DOWN</font>"."<br />";
if (Visit("$url6")) echo "<a href='$url6'/>$url6</a>"." OK"."<br />"; else echo "<font color='red'>$url6 DOWN</font>"."<br />";
if (Visit("$url7")) echo "<a href='$url7'/>$url7</a>"." OK"."<br />"; else echo "<font color='red'>$url7 DOWN</font>"."<br />";
if (Visit("$url8")) echo "<a href='$url8'/>$url8</a>"." OK"."<br />"; else echo "<font color='red'>$url8 DOWN</font>"."<br />";
if (Visit("$url9")) echo "<a href='$url9'/>$url9</a>"." OK"."<br />"; else echo "<font color='red'>$url9 DOWN</font>"."<br />";
if (Visit("$url10")) echo "<a href='$url10'/>$url10</a>"." OK"."<br />"; else echo "<font color='red'>$url10 DOWN</font>"."<br />";
if (Visit("$url11")) echo "<a href='$url11'/>$url11</a>"." OK"."<br />"; else echo "<font color='red'>$url11 DOWN</font>"."<br />";
if (Visit("$url12")) echo "<a href='$url12'/>$url12</a>"." OK"."<br />"; else echo "<font color='red'>$url12 DOWN</font>"."<br />";
if (Visit("$url13")) echo "<a href='$url13'/>$url13</a>"." OK"."<br />"; else echo "<font color='red'>$url13 DOWN</font>"."<br />";
if (Visit("$url14")) echo "<a href='$url14'/>$url14</a>"." OK"."<br />"; else echo "<font color='red'>$url14 DOWN</font>"."<br />";
if (Visit("$url15")) echo "<a href='$url15'/>$url15</a>"." OK"."<br />"; else echo "<font color='red'>$url15 DOWN</font>"."<br />";
if (Visit("$url16")) echo "<a href='$url16'/>$url16</a>"." OK"."<br />"; else echo "<font color='red'>$url16 DOWN</font>"."<br />";
if (Visit("$url17")) echo "<a href='$url17'/>$url17</a>"." OK"."<br />"; else echo "<font color='red'>$url17 DOWN</font>"."<br />";
if (Visit("$url18")) echo "<a href='$url18'/>$url18</a>"." OK"."<br />"; else echo "<font color='red'>$url18 DOWN</font>"."<br />";
if (Visit("$url19")) echo "<a href='$url19'/>$url19</a>"." OK"."<br />"; else echo "<font color='red'>$url19 DOWN</font>"."<br />";
if (Visit("$url20")) echo "<a href='$url20'/>$url20</a>"." OK"."<br />"; else echo "<font color='red'>$url20 DOWN</font>"."<br />";
if (Visit("$url21")) echo "<a href='$url21'/>$url21</a>"." OK"."<br />"; else echo "<font color='red'>$url21 DOWN</font>"."<br />";
if (Visit("$url22")) echo "<a href='$url22'/>$url22</a>"." OK"."<br />"; else echo "<font color='red'>$url22 DOWN</font>"."<br />";
if (Visit("$url23")) echo "<a href='$url23'/>$url23</a>"." OK"."<br />"; else echo "<font color='red'>$url23 DOWN</font>"."<br />";
if (Visit("$url24")) echo "<a href='$url24'/>$url24</a>"." OK"."<br />"; else echo "<font color='red'>$url24 DOWN</font>"."<br />";
if (Visit("$url25")) echo "<a href='$url25'/>$url25</a>"." OK"."<br />"; else echo "<font color='red'>$url25 DOWN</font>"."<br />";
if (Visit("$url26")) echo "<a href='$url26'/>$url26</a>"." OK"."<br />"; else echo "<font color='red'>$url26 DOWN</font>"."<br />";
if (Visit("$url27")) echo "<a href='$url27'/>$url27</a>"." OK"."<br />"; else echo "<font color='red'>$url27 DOWN</font>"."<br />";
if (Visit("$url28")) echo "<a href='$url28'/>$url28</a>"." OK"."<br />"; else echo "<font color='red'>$url28 DOWN</font>"."<br />";
if (Visit("$url29")) echo "<a href='$url29'/>$url29</a>"." OK"."<br />"; else echo "<font color='red'>$url29 DOWN</font>"."<br />";
if (Visit("$url30")) echo "<a href='$url30'/>$url30</a>"." OK"."<br />"; else echo "<font color='red'>$url30 DOWN</font>"."<br />";
if (Visit("$url31")) echo "<a href='$url31'/>$url31</a>"." OK"."<br />"; else echo "<font color='red'>$url31 DOWN</font>"."<br />";
?>