Jump to content

How to get only links with <h2> tags


t_machine

Recommended Posts

Hi, I am trying to parse a page that contain many links. There are links on there with <h2> tags which are the ones I need. How can I get only those links?

I am using the following but it returns every link.

 

$regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; 

 

The <h2> links on the page are like the following:

<a href="link to page"><h2>LINK NAME</h2></a>

 

Thanks for any help :)

Link to comment
https://forums.phpfreaks.com/topic/159217-how-to-get-only-links-with-tags/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.