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? Quote Link to comment Share on other sites More sharing options...
sasa Posted March 12, 2011 Share Posted March 12, 2011 change to foreach ($imglinks[1] as $imagelink){ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.