Problème avec une expression réguliere
Bonjour a tous , j'ai un probleme avec un expression réguliere :
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| $ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, 'www.monsiteWeb.com');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
$lines = array();
$lines = explode("\n", $file_contents);
// affichage ligne par ligne
foreach($lines as $line_num => $line) {
//echo " ".htmlspecialchars($line)."<br />\n";
$src = $line;
preg_match_all("#<div class=\"numero\">(.*)</div>#Us",$src,$split);
for($i=0;$i<count($split[0]);$i++){
echo $split[0][$i]."<br>";
}
} |
Le résultat de mon expression est la suivante :
5
2
55
221
45
857
554
1125
221
1
21
Je voudrai moi tout simplement afficher les 4 premiers numéro et pas les autres.
Voila j'espere que quelqu'un pourra m'aider
merci