I've following two variables which contains the HTML code :
$var1= Profile photo uploaded<div class="comment_attach_image">
<a class="group1 cboxElement"
href="http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png" >
<img src="http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png" height="150px" width="150px" />
</a>
<a class="comment_attach_image_link_dwl" href="http://52.1.47.143/feed/download/year_2015/month_03/file_a4ea5532b83a56bbbae2fffc80de4fee.png" >Download</a>
</div>
$var2 = PDF file added<div class="comment_attach_file">
<a class="comment_attach_file_link" href="http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf" >1b87d4420c693f2bbdf738cbf2457d89.pdf</a>
<a class="comment_attach_file_link_dwl" href="http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf" >Download</a>
</div>
I want to extract only the URL's from the above two variables. What I want from the above two variables is as follows :
$new_var1 = http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png;
$new_var2 = http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf ;
How to do this in an efficient and smarter way in PHP?