Jump to content

Recommended Posts

working on a project for a client where we copied a form onto our page which passes over to another domain. they want me to write something on my page though that can check the status of their server, make sure the page is active. and if it's not i'm supposed to hide my form and put up a message basically saying "out of order"...

 

they offered to put something on their page like a meta tag that either says "active" or "inactive" and want me to parse their page for this...

 

does anyone have a better idea? or anything? any input appreciated.

 

thanks!

Damn dude I wrote something like this a whole back to have it check my primary server from a remote host.  If the connection took longer than 20 seconds it would fire off an SMS message to my cell phone.  Haha found it:

$fo = fsockopen('domain.com', 80);

if(!$fo)
{
	mail('email@email.com', 'site down', 'unable to connect on port 80 @ '.$date('H:m:s'));
}

 

I've seen some fancier stuff on phpclasses.org but I wanted something quick and dirty and thats exactly what this is.  You could use something like curl and use its functionality for the exact HTTP code if this is a web server, but anyways there are plenty of ways to skin this one.  Hope that works for you.

Cant you set a low socket timeout?

 

http://us3.php.net/manual/en/function.fsockopen.php

 

resource fsockopen  ( string $hostname  [, int $port  [, int &$errno  [, string &$errstr  [, float $timeout  ]]]] )

Here is what I would do:

Show the form always. Hide and disable it using javascript when the page loads. Check the server status using AJAX. If the server responds then show the form using javascript, otherwise give them the message saying the server is down.

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.