I'm using cURL to grab a page and I want to parse out the title of the post (the actual text shown on the link, not the title attribute of the <a>
).
The HTML is like this:
<li class="topic">
<a title="Permanent Link to Blog Post" rel="bookmark" href="http://www.website.com/blog-post/">Title of blog post</a>
</li>
I tried using this code:
preg_match('/<\a title=\".*\" rel=\"bookmark\" href=\".*\">.*<\/a>/', $page, $matches);
But it's not working, PHP returns Array ( )
(an empty array).
Can anyone supply me the regex to do this? I've tried online generators but it goes right over my head. Cheers!