Check remote server status

This is a discussion on Check remote server status within the alt.comp.lang.php forums, part of the PHP Programming Forums category; My website redirect a certain page to another on an different server because that (generated) page is always up-to-...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-30-2004
John Smith
 
Posts: n/a
Default Check remote server status

My website redirect a certain page to another on an different server because
that (generated) page is always up-to-date.
Only that server isn't stable all the time.
I'm looking for a quick way to check if the server (and the page) is online
(by retrieving the headers?) so that if it isn't I can use redirect to a
less up-to-date page.

Can anyone help me with this???


Reply With Quote
  #2 (permalink)  
Old 01-30-2004
CountScubula
 
Posts: n/a
Default Re: Check remote server status

"John Smith" <someone@nobody.com> wrote in message
news:bve88j$if1$1@news1.tilbu1.nb.home.nl...
> My website redirect a certain page to another on an different server

because
> that (generated) page is always up-to-date.
> Only that server isn't stable all the time.
> I'm looking for a quick way to check if the server (and the page) is

online
> (by retrieving the headers?) so that if it isn't I can use redirect to a
> less up-to-date page.
>
> Can anyone help me with this???
>
>


$otherPage = implode("",file("http://www.othersite.com/otherpage.html"));

--
Mike Bradley
http://www.gzentools.com -- free online php tools


Reply With Quote
  #3 (permalink)  
Old 01-31-2004
John Smith
 
Posts: n/a
Default Re: Check remote server status

This gives me the file, but I want to redirect to that server if it's online
by using file() it waits and waits if the server is down.
I did something similar (along time ago) with Perl there I used an
HTTPstatus-request for the file.

"CountScubula" <me@scantek.hotmail.com> schreef in bericht
news:xSzSb.7956$BO6.2722@newssvr29.news.prodigy.co m...
> "John Smith" <someone@nobody.com> wrote in message
> news:bve88j$if1$1@news1.tilbu1.nb.home.nl...
> > My website redirect a certain page to another on an different server

> because
> > that (generated) page is always up-to-date.
> > Only that server isn't stable all the time.
> > I'm looking for a quick way to check if the server (and the page) is

> online
> > (by retrieving the headers?) so that if it isn't I can use redirect to a
> > less up-to-date page.
> >
> > Can anyone help me with this???
> >
> >

>
> $otherPage = implode("",file("http://www.othersite.com/otherpage.html"));
>
> --
> Mike Bradley
> http://www.gzentools.com -- free online php tools
>
>



Reply With Quote
  #4 (permalink)  
Old 01-31-2004
CountScubula
 
Posts: n/a
Default Re: Check remote server status

ok, if you just want the headers, then it will still wait and wait if the
server is down.

Now, are you refering to server down as the http service or the physical
server itself?

you can try to open a socket to the machine?

Are you trying to see if it is up on every request from your page? not good
idea if so.

try getting the file() its simpler, and do it from a cron job that runs ever
X minutes, thus saving bandwidth, cpu usage etc.. and eliminating any delays
if server is down.


--
Mike Bradley
http://www.gzentools.com -- free online php tools
"John Smith" <someone@nobody.com> wrote in message
news:bvfrbn$c61$1@news2.tilbu1.nb.home.nl...
> This gives me the file, but I want to redirect to that server if it's

online
> by using file() it waits and waits if the server is down.
> I did something similar (along time ago) with Perl there I used an
> HTTPstatus-request for the file.
>
> "CountScubula" <me@scantek.hotmail.com> schreef in bericht
> news:xSzSb.7956$BO6.2722@newssvr29.news.prodigy.co m...
> > "John Smith" <someone@nobody.com> wrote in message
> > news:bve88j$if1$1@news1.tilbu1.nb.home.nl...
> > > My website redirect a certain page to another on an different server

> > because
> > > that (generated) page is always up-to-date.
> > > Only that server isn't stable all the time.
> > > I'm looking for a quick way to check if the server (and the page) is

> > online
> > > (by retrieving the headers?) so that if it isn't I can use redirect to

a
> > > less up-to-date page.
> > >
> > > Can anyone help me with this???
> > >
> > >

> >
> > $otherPage =

implode("",file("http://www.othersite.com/otherpage.html"));
> >
> > --
> > Mike Bradley
> > http://www.gzentools.com -- free online php tools
> >
> >

>
>



Reply With Quote
  #5 (permalink)  
Old 01-31-2004
John Smith
 
Posts: n/a
Default Re: Check remote server status

I meant the service.

Thanks I will try that and of course I won't check this on every page.
I don't if I can use a cron job since the server is not hosted by me.


"CountScubula" <me@scantek.hotmail.com> schreef in bericht
news:wsKSb.18278$871.1368@newssvr27.news.prodigy.c om...
> ok, if you just want the headers, then it will still wait and wait if the
> server is down.
>
> Now, are you refering to server down as the http service or the physical
> server itself?
>
> you can try to open a socket to the machine?
>
> Are you trying to see if it is up on every request from your page? not

good
> idea if so.
>
> try getting the file() its simpler, and do it from a cron job that runs

ever
> X minutes, thus saving bandwidth, cpu usage etc.. and eliminating any

delays
> if server is down.
>
>
> --
> Mike Bradley
> http://www.gzentools.com -- free online php tools
> "John Smith" <someone@nobody.com> wrote in message
> news:bvfrbn$c61$1@news2.tilbu1.nb.home.nl...
> > This gives me the file, but I want to redirect to that server if it's

> online
> > by using file() it waits and waits if the server is down.
> > I did something similar (along time ago) with Perl there I used an
> > HTTPstatus-request for the file.
> >
> > "CountScubula" <me@scantek.hotmail.com> schreef in bericht
> > news:xSzSb.7956$BO6.2722@newssvr29.news.prodigy.co m...
> > > "John Smith" <someone@nobody.com> wrote in message
> > > news:bve88j$if1$1@news1.tilbu1.nb.home.nl...
> > > > My website redirect a certain page to another on an different server
> > > because
> > > > that (generated) page is always up-to-date.
> > > > Only that server isn't stable all the time.
> > > > I'm looking for a quick way to check if the server (and the page) is
> > > online
> > > > (by retrieving the headers?) so that if it isn't I can use redirect

to
> a
> > > > less up-to-date page.
> > > >
> > > > Can anyone help me with this???
> > > >
> > > >
> > >
> > > $otherPage =

> implode("",file("http://www.othersite.com/otherpage.html"));
> > >
> > > --
> > > Mike Bradley
> > > http://www.gzentools.com -- free online php tools
> > >
> > >

> >
> >

>
>



Reply With Quote
  #6 (permalink)  
Old 01-31-2004
John Smith
 
Posts: n/a
Default Re: Check remote server status

I've used fsockopen($host, 80) to make a HEAD-request
It works fine.
It doesn't wait and wait if the server is down because of the connection
between the servers is so short and fast. (at least not for 1 request)
I also buffer the result so that it's checked only when the server isn't
down.
If it's down it will check only once each X minutes en the next X minutes
will be the other page.

ThanX for the help I've never used sockets before with PHP

p.s. perhaps PHP needs a better and faster way to check headers.

"CountScubula" <me@scantek.hotmail.com> schreef in bericht
news:wsKSb.18278$871.1368@newssvr27.news.prodigy.c om...
> ok, if you just want the headers, then it will still wait and wait if the
> server is down.
>
> Now, are you refering to server down as the http service or the physical
> server itself?
>
> you can try to open a socket to the machine?
>
> Are you trying to see if it is up on every request from your page? not

good
> idea if so.
>
> try getting the file() its simpler, and do it from a cron job that runs

ever
> X minutes, thus saving bandwidth, cpu usage etc.. and eliminating any

delays
> if server is down.
>
>
> --
> Mike Bradley
> http://www.gzentools.com -- free online php tools
> "John Smith" <someone@nobody.com> wrote in message
> news:bvfrbn$c61$1@news2.tilbu1.nb.home.nl...
> > This gives me the file, but I want to redirect to that server if it's

> online
> > by using file() it waits and waits if the server is down.
> > I did something similar (along time ago) with Perl there I used an
> > HTTPstatus-request for the file.
> >
> > "CountScubula" <me@scantek.hotmail.com> schreef in bericht
> > news:xSzSb.7956$BO6.2722@newssvr29.news.prodigy.co m...
> > > "John Smith" <someone@nobody.com> wrote in message
> > > news:bve88j$if1$1@news1.tilbu1.nb.home.nl...
> > > > My website redirect a certain page to another on an different server
> > > because
> > > > that (generated) page is always up-to-date.
> > > > Only that server isn't stable all the time.
> > > > I'm looking for a quick way to check if the server (and the page) is
> > > online
> > > > (by retrieving the headers?) so that if it isn't I can use redirect

to
> a
> > > > less up-to-date page.
> > > >
> > > > Can anyone help me with this???
> > > >
> > > >
> > >
> > > $otherPage =

> implode("",file("http://www.othersite.com/otherpage.html"));
> > >
> > > --
> > > Mike Bradley
> > > http://www.gzentools.com -- free online php tools
> > >
> > >

> >
> >

>
>



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:18 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0