| Philip Ronan 2005-11-16, 6:56 pm |
| "Peter" wrote:
> Hi,
>
> I wonder if the following is possible ?
>
> Based on variables passed to a script I finally launch the appropriate page
> (always a third party page on another server)
>
> Like this :
>
> header("Location: $newurl"); // re-direct
>
> I now wonder, suppose this third party page is offline and instead of
> getting the "this page cannot be displayed" from IE is it possible to detect
> that and maybe put up another page ? Like, "please come back in while" or
> something like that ?
No. Once the client's browser has been redirected from your site, it won't
come back until the user tells it to.
Your two options are:
1) Periodically check your outgoing links to make sure they are still
valid.
2) Before sending out the "Location" header, use @fopen("$newurl") to
check that the URL is actually accessible. If not, do something else.
Option 2 isn't foolproof, because if there's a lot of traffic on the
network, a site that your server can't reach may still be accessible to the
user. And obviously it slows things up and generates extra traffic.
--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/
|