You could just use a for loop:
$file = '/path/to/file.php';
$worked = FALSE;
for( $i=0; $i<3; $++ ) {
$text = file_get_contents($file);
if( $text !== FALSE ) {
$worked = TRUE;
break;
}
}
if( $worked ) {
echo 'get_contents worked';
} else {
echo 'get_contents failed';
}
This is just pseudo code, you'll have to modify it as necessary ust trying to give you an idea.