1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
| $str='<table width="100%" cellspacing="0" cellpadding="0" border="0" class="tab">
<tbody><tr>
<td width="10" valign="top" class="img" rowspan="4"><a rel="" class="ceebox" href="3945.jpg"><img border="0" alt="nom" src="3945_mini.jpg"/></a></td>
<td valign="top" height="16"><span style="color: rgb(5, 171, 239);" class="nom">nom</span> <span class="Style">genre</span></td>
</tr>
<tr>
<td valign="top" class="Nat">FR</td>
</tr>
<tr>
<td valign="top" class="Bio"><p>Physicus quidam, mathematicus et Dialecticae peritus una tramine vehuntur ut Londinium petant. Cum e cuniculo discedant, ovem nigram per fenestram cernunt. Physicus illa dicit : "Hem ! Omnes oves anglicae nigrae sunt." Mathematicus corrigit : "Minime, Tantum autumare possumus in Anglia exstare unam saltem ovem quae nigra est."
Tunc dialecticus corrigit : "Minime, tantum asserere possumus in Anglia exstitisse unam saltem ovem, per paucas secundas dumtaxat, quae nigra erat in una saltem pariete."</p></td>
</tr>
<tr>
<td class="Links">
<a target="_blank" href="http://www.abcd.com/poiu">abcd</a><a target="_blank" href="http://www.poiu.com/">site</a>
</td>
</tr>
</tbody></table>
<table width="100%" cellspacing="0" cellpadding="0" border="0" class="tab">
<tbody><tr>
<td width="10" valign="top" class="img" rowspan="4"><a rel="" class="ceebox" href="3945.jpg"><img border="0" alt="nom" src="3945_mini.jpg"/></a></td>
<td valign="top" height="16"><span style="color: rgb(5, 171, 239);" class="nom">nom</span> <span class="Style">genre</span></td>
</tr>
<tr>
<td valign="top" class="Nat">FR</td>
</tr>
<tr>
<td valign="top" class="Bio"><p>Physicus quidam, mathematicus et Dialecticae peritus una tramine vehuntur ut Londinium petant. Cum e cuniculo discedant, ovem nigram per fenestram cernunt. Physicus illa dicit : "Hem ! Omnes oves anglicae nigrae sunt." Mathematicus corrigit : "Minime, Tantum autumare possumus in Anglia exstare unam saltem ovem quae nigra est."
Tunc dialecticus corrigit : "Minime, tantum asserere possumus in Anglia exstitisse unam saltem ovem, per paucas secundas dumtaxat, quae nigra erat in una saltem pariete."</p></td>
</tr>
<tr>
<td class="Links">
<a target="_blank" href="http://www.abcd.com/lebon">abcd</a><a target="_blank" href="http://www.lebon.com/">site</a>
</td>
</tr>
</tbody></table>
<table width="100%" cellspacing="0" cellpadding="0" border="0" class="tab">
<tbody><tr>
<td width="10" valign="top" class="img" rowspan="4"><a rel="" class="ceebox" href="3945.jpg"><img border="0" alt="nom" src="3945_mini.jpg"/></a></td>
<td valign="top" height="16"><span style="color: rgb(5, 171, 239);" class="nom">nom</span> <span class="Style">genre</span></td>
</tr>
<tr>
<td valign="top" class="Nat">FR</td>
</tr>
<tr>
<td valign="top" class="Bio"><p>Physicus quidam, mathematicus et Dialecticae peritus una tramine vehuntur ut Londinium petant. Cum e cuniculo discedant, ovem nigram per fenestram cernunt. Physicus illa dicit : "Hem ! Omnes oves anglicae nigrae sunt." Mathematicus corrigit : "Minime, Tantum autumare possumus in Anglia exstare unam saltem ovem quae nigra est."
Tunc dialecticus corrigit : "Minime, tantum asserere possumus in Anglia exstitisse unam saltem ovem, per paucas secundas dumtaxat, quae nigra erat in una saltem pariete."</p></td>
</tr>
<tr>
<td class="Links">
<a target="_blank" href="http://www.abcd.com/azerty">abcd</a><a target="_blank" href="http://www.azerty.com/">site</a>
</td>
</tr>
</tbody></table>';
//j'ai essayé ce qui suit mais ça me renvoi toutes les tables :
$link="http://www.abcd.com/lebon";
$slash2p = array("/", ":");
$slash2pok = array("\/", "\:");
$linkok = str_replace($slash2p , $slash2pok , $link);
if(preg_match("#<table(.*?).*".$newlink.".*</table>#is", $str, $matches))
{
echo '<pre>' . htmlentities(print_r($matches, true)) . '</pre>';
} |
Partager