I want a Mirror script which determines whether or not a certain file is accessible or not. If the mirror1 is accessible, it will present the link to mirror 1. If mirror 1 is not accessible, it will present the link to mirror 2.
This so far is perfect, however I would like more mirrors. For example, if mirror 2 is unavailable, mirror 3 will be presented. If mirror 3 is unavailable, mirror 4 will be presented and so on. I'm just not quite sure exactly how I could make this work. Has anyone got any suggestions that would be highly appreciated. I've tried quite a lot of things already!
$mirror1 = "download1.exe";
$mirror2 = "download2.exe";
$header_response = get_headers($mirror1, 1);
if ( strpos( $header_response[0], "404" ) !== false )
{
echo '
<a href="', $mirror1, '">Download Mirror 1</a>
';
}
else
{
echo '
<a href="', $mirror2, '">Download Mirror 2</a>
';
}