On Thu, May 29, 2008 at 8:13 PM, Eric Butera <[EMAIL PROTECTED]> wrote:
> Why not use DOMDocument with getElementsByTagName('href') [1]
>
> http://us2.php.net/manual/en/domdocument.getelementsbytagname.php
>

Sorry there was an error in that.  It felt wrong when I sent it so I
looked again.  Here is a snippet I'm using on a project right now, so
I know it works. ;)

$dom = DOMDocument::loadHTML($vo->htmlCopy);
foreach ($dom->getElementsByTagName('a') as $node) {
    if ($node->hasAttribute('href')) {
        $linkVO = new ...;
        $linkVO->url            = $node->getAttribute('href');
        $linkVO->name           = $node->nodeValue;

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to