PDA

View Full Version : CGI->PHP | Very usefull script


wooolF[RM]
04-19-2002, 03:58 PM
]Hello all!
Just found a CGI script that checks any given server and idf it's alive, it returns live.gif (green.gif etc). If not - dead.gif (red.gif).
Very useful :)

The problem is : I can't use CGI on my host and my hoster wont enable it. Could anyone please convert it to PHP?

Any help appreciatted.

wooolF[RM]
04-20-2002, 08:41 PM
]hmm.. 7 downloads and no responce at all? :(

wooolF[RM]
05-13-2002, 03:06 AM
]18 downloads and still nothing? :(

Logician
05-13-2002, 09:50 AM
<?php
if (!$url) {echo "No URL";exit;}

$fp = @fopen("$url","r");
if ($fp)
{
echo "The address valid!";
}
else
{
echo "The address invalid";
}
?>

is the code very basically doing the same thing.. Save it to a file (eg.online.php) and upload it to your server. Then call your file like

url/online.php?url=http://www.domain.com/filetocheck.html

it will return "address is valid" message if the url(page) exits.

Of course you can enhance the code if you want, that is just the algorithm in PHP.

wooolF[RM]
05-13-2002, 11:34 AM
]thanx, I'll try it out ;)