Hi, I've made an php tool for administrating a lot of different files on different servers, and when the servers are down, nobody can download anything. So, I thought, I could make a 'link checker', so anyone can see is this file 'up' or 'down' before they click on the file.
First I downloaded from www.hotscripts.com a link checker, but this thing is not working.
This is code from this script, I just modified it a litle bit:
$link = "http://www.xxxxxxxx.com/download/xxx.exe";
$check = fsockopen($link, 80, &$errno, &$errstr, 30);
if(!$check)
{
echo "<font color=\"red\"><b>$link DOWN !!</b></font>\n";
}
else
{
echo "<font color=\"red\"><b>$link OK - $check !!</b></font>\n";
}
It works if I if $link="http://www.php.net", but it's not working with files.
So I tried something else using some other commands (instead of fsockopen) like:
- filesize — Gets file size (if can't get it, the file is probably down)
- linkinfo — Gets information about a link
...
but these commands work only if files are on my server (where the script is). if the file is somewhere outside, nothing happens, because it can't reach it.
My question is:
Are there any other 'link checkers', or do you have any suggestions how to solve this.
Thanx a lot