komirad Posted July 16, 2009 Share Posted July 16, 2009 The links in the html looks something like this, with many iterations: <h2 class="lists">Section Name(variable1)</h2> <ul class="listings"> <li><a href="variable2" title="variable3">variable4</a></li> <li><a href="variable2" title="variable3">variable4</a></li> <li><a href="variable2" title="variable3">variable4</a></li> <li><a href="variable2" title="variable3">variable4</a></li> </ul> I need the links to be seperated by the section name. So the result array would be something like this, with each item contain the details of the link such as the title, url and anchor text: Section 1: link1, link2, link3 Section 2: link1, link2, link3 I managed to extract the links, but I couldn't find to list them according to their Sections with the following code: preg_match_all('/href="([^"]+)"[^>]*>([^<]+)/',$pageCode,$resultArray); Any help? Quote Link to comment https://forums.phpfreaks.com/topic/166148-need-help-with-extracting-links/ 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.