I need to capture all links in a given html.
Here is sample code:
<div class="infobar">
... some code goes here ...
<a href="/link/some-text">link 1</a>
<a href="/link/another-text">link 2</a>
<a href="/link/blabla">link 3</a>
<a href="/link/whassup">link 4</a>
... some code goes here ...
</div>
I need to get all links inside div.infobar
that starts with /link/
I tried this:
preg_match_all('#<div class="infobar">.*?(href="/link/(.*?)") .*?</div>#is', $raw, $x);
but it gives me the only first match.
Thanks for advices.