Jump to content


PHP - Guru needed !Redirect page on remote web host when local server is offline

  • Please log in to reply
3 replies to this topic

#1 buzzme

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 06 August 2006 - 06:35 AM

I hope some one can help . I have my web site hosted on powweb and I want a user to be redirected when they access my local image server through a link on my web site to another page on my web site when my local image server is offline . I trust this makes sense and all replies welcome .

I have tried the following script but when my local server is offline it fails to redirect to a page on my website which lets the user know the server is offline .

if (! $sock = @fsockopen('localserver', 80, $num, $error, 2))
header("location: http://some_local_se...ct=0.46875,0.59 375,0.53125,0.65625&wid=300&hei=300&lng=en_US&enab lePastMaxZoom=OFF&page=simple/simple2.htm&obj=uv,1.0&cmd=reset");
else {
header("location: http://www.website_h...e_message.html");

P.S. It redirects to the first header okay .

#2 redarrow

  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 06 August 2006 - 06:38 AM

the only way to do that is have your own dns server ok.
Wish i new all about php DAM i will have to learn

#3 buzzme

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 06 August 2006 - 06:49 AM

Thanks for the reply but I am already using one through www.no-ip.com . I am using their free service atm but do not see a redirect function when the server is unreachable . Does anyone know a free dns service that provides this ???? Or does anyone have a work around using curl or fsockopen ????

#4 Prismatic

  • Members
  • PipPipPip
  • Advanced Member
  • 503 posts
  • LocationSan Diego

Posted 06 August 2006 - 07:07 AM

run a cron job every 5 minutes or so that checks if your server is up or down. Have the script change a link in the database depending on if it's up or not, this is the link you will display.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users