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-...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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??? |
|
|||
|
"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 |
|
|||
|
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 > > |
|
|||
|
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 > > > > > > |
|
|||
|
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 > > > > > > > > > > > > |
|
|||
|
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 > > > > > > > > > > > > |