etrader Posted March 12, 2011 Share Posted March 12, 2011 I have html files with this format ..... <!--ImageSection--><div class="image"><!--ImageSection--><div align="top"><b>Image Link</b> <br />http://www.something.com <br />http://www.another_url <br /></div><!--ImageEnd--></div><!--ImageEnd--></div> ..... I tried to get the content of a <div> with this code: preg_match_all('/<div class=\"image\">\<!--ImageSection-->\<div align=\"top\">([^`]*?)<\/div>/', $html, $imglinks); foreach ($imglinks as $imglink){ echo $imagelink; } but it returns empty, where did I wrong? Link to comment https://forums.phpfreaks.com/topic/230412-getting-the-content-of-with-reg_match_all/ Share on other sites More sharing options...
sasa Posted March 12, 2011 Share Posted March 12, 2011 change to foreach ($imglinks[1] as $imagelink){ Link to comment https://forums.phpfreaks.com/topic/230412-getting-the-content-of-with-reg_match_all/#findComment-1186599 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.