Page 1 of 1

find URL in code

Posted: Sat Jul 31, 2010 7:48 am
by fer0an
hello
I've some code same as below:

Code: Select all

<div class="center"><a href="http://hotfile.com/dl/58656550/d2428c9/INV.1908.pdf.html" target="_blank" rel="nofollow">Hotfile</a><br/>
<br/>
<a href="http://sharingmatrix.com/file/15447295/INV.1908.pdf" target="_blank" rel="nofollow">Sharingmatrix</a></div>
</div>
now I wan extract URL of links from it.
sometimes this codes have 1 or 2 or 3 url.
can anyone help me?

Re: find URL in code

Posted: Sun Aug 01, 2010 12:13 am
by fer0an
preg_match_all('#<a[^>]* href=("|\')([^\1]+)\1[^>]*>#U', $input, $out);
print_r($out);