par
trash_board » 22 janv. 2006, 15:22
Ca y est je me suis enfin enregistré
Donc j'ai reussi à faire ce que je voulais
Voici le fichier HTML que je parse !
Code : Tout sélectionner
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>absence</title>
<meta name="Microsoft Border" content="t, default">
</head>
<body bgcolor="#FFFFCC"><!--msnavigation--><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td>
<p align="center"><script language="JavaScript" src="http://adv.surinter.net/richmedia.adv?id=9229"></script>
</p>
</td></tr><!--msnavigation--></table><!--msnavigation--><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><!--msnavigation--><td valign="top">
<p align="center" style="line-height: 100%; word-spacing: 0; border-style: solid; border-width: 1"><font face="Script MT Bold" size="6">Absence</font></p>
<font SIZE="2">
<p align="center" style="line-height: 100%; word-spacing: 0; margin-top: 0; margin-bottom: 0"> </p>
</font>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3">"Ce qui est dévié ne peut être redressé, et ce qui manque ne peut être compté."</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3" color="#006699">L'Ecclésiaste
I, 15</font></p>
<font SIZE="2">
<p align="center" style="margin-top: 10; margin-bottom: 5"> </p>
</font>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3">"Il
n'est pas d'amour qui résiste à l'absence."</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3" color="#006699">Anatole
France, La rôtisserie de la reine Pédauque.</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"> </p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3">"L'
absence est le plus grand des maux."</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3" color="#006699">Jean
de La Fontaine, Les deux pigeons.</font></p>
<font SIZE="2">
<p align="center" style="margin-top: 0; margin-bottom: 5"> </p>
</font>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3">"L'absence
est aussi bien un remède à la haine qu'un appareil contre l'amour."</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3" color="#006699">Jean
de La Fontaine, Fables.</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"> </p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3">"Un
seul être vous manque, et tout est dépeuplé."</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3" color="#006699">Alphonse
de Lamartine, Méditations.</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"> </p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3">"Les
absents ont toujours tort."</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3" color="#006699">Destouches,
L'obstacle imprévu.</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"> </p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3">"L'absence
est à l'amour ce qu'est au feu le vent ; Il éteint le petit, il allume le
grand."</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3" color="#006699">Bussy-Rabutin,
L'histoire amoureuse des Gaules.</font></p>
<p style="margin-top: 10; margin-bottom: 0"> <!--msnavigation--></td></tr><!--msnavigation--></table></body>
</html>
Voici mon script qui me permet de recuperer les citations et les auteurs :
Code : Tout sélectionner
function Recup($masque)
{
$fichier = file_get_contents("Absence.htm",FALSE); //Je cherche le fichier dans le buffer directement ;)
preg_match_all($masque,$fichier,$donnee);
for($i=0;$i<sizeof($donnee[0]);$i++)
{
if($donnee[1][$i])
{
if($donnee[1][0]){$theme = $donnee[1][0];}
//echo $i.'='.$donnee[1][$i].'<br>';
$ici = $donnee[1][$i]."\r";
file_put_contents("$theme.txt",$ici); // fonctionne uniquement sous PHP 5.1
}
}
}
$all = "'<font[^\<\>]*\>([^<]*)<\/font\>'";
Recup($all);
Ca y est je me suis enfin enregistré :o
Donc j'ai reussi à faire ce que je voulais :wink:
Voici le fichier HTML que je parse !
[code]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>absence</title>
<meta name="Microsoft Border" content="t, default">
</head>
<body bgcolor="#FFFFCC"><!--msnavigation--><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td>
<p align="center"><script language="JavaScript" src="http://adv.surinter.net/richmedia.adv?id=9229"></script>
</p>
</td></tr><!--msnavigation--></table><!--msnavigation--><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><!--msnavigation--><td valign="top">
<p align="center" style="line-height: 100%; word-spacing: 0; border-style: solid; border-width: 1"><font face="Script MT Bold" size="6">Absence</font></p>
<font SIZE="2">
<p align="center" style="line-height: 100%; word-spacing: 0; margin-top: 0; margin-bottom: 0"> </p>
</font>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3">"Ce qui est dévié ne peut être redressé, et ce qui manque ne peut être compté."</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3" color="#006699">L'Ecclésiaste
I, 15</font></p>
<font SIZE="2">
<p align="center" style="margin-top: 10; margin-bottom: 5"> </p>
</font>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3">"Il
n'est pas d'amour qui résiste à l'absence."</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3" color="#006699">Anatole
France, La rôtisserie de la reine Pédauque.</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"> </p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3">"L'
absence est le plus grand des maux."</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3" color="#006699">Jean
de La Fontaine, Les deux pigeons.</font></p>
<font SIZE="2">
<p align="center" style="margin-top: 0; margin-bottom: 5"> </p>
</font>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3">"L'absence
est aussi bien un remède à la haine qu'un appareil contre l'amour."</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3" color="#006699">Jean
de La Fontaine, Fables.</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"> </p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3">"Un
seul être vous manque, et tout est dépeuplé."</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3" color="#006699">Alphonse
de Lamartine, Méditations.</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"> </p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3">"Les
absents ont toujours tort."</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3" color="#006699">Destouches,
L'obstacle imprévu.</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"> </p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3">"L'absence
est à l'amour ce qu'est au feu le vent ; Il éteint le petit, il allume le
grand."</font></p>
<p align="center" style="margin-top: 0; margin-bottom: 5"><font size="3" color="#006699">Bussy-Rabutin,
L'histoire amoureuse des Gaules.</font></p>
<p style="margin-top: 10; margin-bottom: 0"> <!--msnavigation--></td></tr><!--msnavigation--></table></body>
</html>
[/code]
Voici mon script qui me permet de recuperer les citations et les auteurs :
[code]
function Recup($masque)
{
$fichier = file_get_contents("Absence.htm",FALSE); //Je cherche le fichier dans le buffer directement ;)
preg_match_all($masque,$fichier,$donnee);
for($i=0;$i<sizeof($donnee[0]);$i++)
{
if($donnee[1][$i])
{
if($donnee[1][0]){$theme = $donnee[1][0];}
//echo $i.'='.$donnee[1][$i].'<br>';
$ici = $donnee[1][$i]."\r";
file_put_contents("$theme.txt",$ici); // fonctionne uniquement sous PHP 5.1
}
}
}
$all = "'<font[^\<\>]*\>([^<]*)<\/font\>'";
Recup($all);
[/code]