Jump to content

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


buzzme

Recommended Posts

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 .

<?php
if (! $sock = @fsockopen('localserver', 80, $num, $error, 2))
header("location: http://some_local_server/fif=cat.fpx&init=0.0,0.0,1.0,1.0&rect=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 {
fclose($sock);
header("location: http://www.website_hosted_on_powweb.com/local_image_server_offline_message.html");
}
?>

P.S. It redirects to the first header okay .
Link to comment
Share on other sites

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 ????
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.