Bonjour tout le monde !
Je vous soumets mon petit probleme :
j'ai un tableau à disposition de ce genre:
Je souhaite extraire le lien html.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 <TR height=18 onmouseover="this.bgColor='#FFFFFF'" onmouseout="this.bgColor='#EFF8FF'" bgcolor=#EFF8FF style="cursor:hand;" onclick="document.location='../../departements/yvelines/mareil-marly.php'"> <TD align=left> <a href="../../departements/yvelines/mareil-marly.php" style='text-decoration:none;'>1</a></TD> .... </TR>
J'ai donc créé le pattern suivant, mais il ne semble pas fonctionner:
Seulement le tableau s'avère être vide...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 $token = "Marly"; $basicUrl = "http://www.lion1906.com/Php/Resultats/Resultat_Localisation1.php?Ville="; $fp = fopen($basicUrl.$token,"r"); while(!feof($fp)) { $page.=fgets($fp, 4096); } //<TD align=left><a href="../../departements/yvelines/mareil-marly.php" style='text-decoration:none;'><B>Mareil-Marly</B></a></TD> preg_match('#<TD align=left><a href="../../([a-z\/]).php"#',$page,$split); fclose($fp); print_r($split); return $split;
Pourriez vous m'aider?
Merci beaucoup !!
Cordialement
EDIT/
Je pense qu'il faut echapper les caractères spéciaux ^^
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 preg_match('#<TD align=left><a href="\.\.\/\.\.\/([a-z\-\/+])\.php"#si',$page,$split);
Mais cela ne change pas grand chose ...![]()
Partager