noter l'utilisation de file qui crée un tableau avec chaque ligne du fichier dans une clé du tableau

function getCode($url){
$code = '';
$lines = file($url);
foreach ($lines as $line_num => $line) {
  $code.= "<div style='background-color:#".($line_num%2==0?'FEFFF2':'FDFFCE').";font-family:Verdana;font-size:11px;border:1px solid #cecece;padding:3px;'>".
  "<h1 style='background-color:#ffffff;padding:3px;font-family:Verdana;font-size:10px;float:left;margin:3px;margin-right:10px;border:1px solid #cecece;'>{$line_num}</h1>" .
  "<div style='margin-top:5px;'>".htmlspecialchars($line) ."</div><div style='clear:left;'></div>".
  "</div>";
}
return $code;
}


echo getCode('http://blog.idleman.fr');