Hi i want to have PHP scripting page if SERVER A Goes down this PHP Page check the status & than Redirect user to SERVER B....

thing is that i made IIS 7 Server on my PC & some time i turn off my PC ill upload this PHP page on free hosting

i want this php page should work like this if some one open my website this php page should check if my server is online than it should open the page from my website if not than it should redirect the user the to this Page "Sorry The Server is Down"

i m using dot.tk Domain My website URL is http://greeny.tk

my website loads it from my Computer. So please help me & tell me how i can make it possible?

I have Script but its not working i dont know why i m gonna show it to you here

<?php
//Web Server Status v 1.4, Copyright 2002 By Ryan Schwiebert, visit http://www.schwebdesigns.com/
//This script may be freely distributed providing all copyright headers are kept intact.

//Concept from:
//Abax Server Status v1.04, Copyright 2002 By Nathan Dickman, visit http://www.NathanDickman.com/
//Location of the live or dead server images

//Please change to your server specifications
$live = "ftp://greeny.is-a-geek.net:13000/live.gif";
$dead = "http://i203.photobucket.com/albums/aa149/greeeeny/dead.gif";

//The status checking script
//meddle at your own risk!
//check for port number, default is 80
$link = $_GET.":";
$s_link = str_replace("::", ":", $link);
list($addr,$port)= explode (':',"$s_link");
if (empty($port)){
$port = 80;
}
//Test the server connection
$churl = @fsockopen(server($addr), $port, $errno, $errstr, 20);
if (!$churl){
//echo $errstr;
header("Location: $dead");
}
else {
header("Location: $live");
}
function server($addr){
if(strstr($addr,"/")){$addr = substr($addr, 0, strpos($addr, "/"));}
return $addr;
}
?>

-------------------------------------------------------------------------

$live = "ftp://greeny.is-a-geek.net:13000/live.gif"; <<<< this picture loads from my PC

$dead = "http://i203.photobucket.com/albums/aa149/greeeeny/dead.gif"; <<< its free image hosting website

problem is when i stop My IIS 7 & check it it does not show Dead.gif on page

now i want you guys to give me solution if it cannot loads image i mean if my server is stopped so it should show this page "The Server is Down" text on that page" so please me out ....

thanks in advance =)

you should redirect your domain to the free hosting...
and place the .php file there...

Member Avatar for nileshgr

Configure DNS round robin on your DNS server and you'll have all problems fixed. Don't go into such practices. How will a PHP script loading from your comp run when your comp is off :P ?

yeh i know but the problem is this script is not working can u send me or give me any working script or php page plz...?

Configure DNS round robin on your DNS server and you'll have all problems fixed. Don't go into such practices. How will a PHP script loading from your comp run when your comp is off :P ?

My dns Server doest give these options thats why i want to have PHP page who check all this & redirect user to this page which will say " THE SERVER is DOWN" ill upload this Php page to the Free Hosting ... all i want is this Page plz design me one if u can...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.