Jump to content

html parsing, almost have it but stuck


cyberkiller

Recommended Posts

I am grabbing a site, I used preg_match to narrow it down to just the snippet I need. The snippet I am using looks like this,

 

<td class="blogPingTime">
                        2:26 PM
                    </td>
                    <td>

                    
                        <a href="http://justonemoremile.blogspot.com/" target="_blank">
                            <img src="/images/feed_icon.png" title="XML feed" alt="XML feed" border="0">
                        </a>
                        
                    </td>
                </tr></table>
                </div>

                <div id="18" class="blog">
                <table class="blog"><tr>
                    <td class="blogName">

                        <a href="clickthru?url=http://ireland-airfare.laureate-cool-links.info/" class="pingLink">
                            Ireland&#32;Airfare</a>
                    </td>

 

There ten of these, out of each ten I want to grab whats in between class="pingLink"> & </ a>  which would be "Ireland&#32;Airfare" The text there will be different for each snippet.

 

Here's my expression,

 

preg_match_all("/class=\"pingLink\">(.*?)<\/a>/ims", $info, $parsed);

 

This results with,

 

class="pingLink">
                            Ireland&#32;Airfare</a> 

 

How do I get rid of the remaining, 

class="pingLink">
and </a> ? 

Link to comment
https://forums.phpfreaks.com/topic/50520-html-parsing-almost-have-it-but-stuck/
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.