Re: Checking if a website is up?
| From: | Curt Zirzow | Date: | Tue, 30 Mar 2004 15:57:56 +0000 |
| Subject: | Re: Checking if a website is up? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181824@lists.php.net to get a copy of this message | ||
* Thus wrote Henry Grech-Cini (henry@teacake.force9.co.uk):
> Hi All,
>
> I am trying to check if a website is up (reachable) and I have used the
> standard code below:
>
> else
> {
> fwrite ($socket, "HEAD ".$documentpath." HTTP/1.0\r\nHost:
> $host\r\n\r\n");
> $http_response = fgets( $socket, 22 );
any reason why you want only 22 bytes?
A response like the following is perfectly valid:
HTTP/1.0 200 its ok but the content wont be
>
> if ( ereg("200 OK", $http_response, $regs ) )
Any response back would mean its up.
> {
> return(true);
> fclose( $socket );
> } else
> {
> // echo "HTTP-Response: $http_response<br>";
What does this say?
Curt
--
"I used to think I was indecisive, but now I'm not so sure."