Jestem nowy na forum. Jestem także początkujący w dziedzinie php. Obecnie mam problem z funkcją preg_match_all.
Potrzebuję wyciągnąć wszystkie odnośniki, które mają określoną budowę i mają słowo "game" w linku. Te potrzebne mi linki mają atrybuty onmouseover i onmouseout.
Kod
<?php
$string = '<a href="http://www.achieve360points.com/game/zerohourinnercircle/" onmouseover="dimg("zerohourinnercircle");" onmouseout="hideddrivetip()">Zero Hour Inner Circle</a>
<a href="http://www.achieve360points.com/game/2006fifaworldcup/" onmouseover="dimg("2006fifaworldcup");" onmouseout="hideddrivetip()">2006 FIFA World Cup</a>';
echo preg_match_all('#<a(.*)href="http://www.achieve360points.com/game/(.*)/"(.*)onmouseover=(.*)>(.*)</a>#', $string, $matches);
?>
$string = '<a href="http://www.achieve360points.com/game/zerohourinnercircle/" onmouseover="dimg("zerohourinnercircle");" onmouseout="hideddrivetip()">Zero Hour Inner Circle</a>
<a href="http://www.achieve360points.com/game/2006fifaworldcup/" onmouseover="dimg("2006fifaworldcup");" onmouseout="hideddrivetip()">2006 FIFA World Cup</a>';
echo preg_match_all('#<a(.*)href="http://www.achieve360points.com/game/(.*)/"(.*)onmouseover=(.*)>(.*)</a>#', $string, $matches);
?>
Nawet, gdy mam listę tych linków, to i tak funkcja podaje, że znalazła tylko jeden taki sam link.
Pomożecie?
DirectPL