Re: preg_match_all

From: Date: Fri, 30 May 2008 00:19:30 +0000
Subject: Re: preg_match_all
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-274848@lists.php.net to get a copy of this message
On Thu, May 29, 2008 at 8:13 PM, Eric Butera <eric.butera@gmail.com> 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;

« previous php.general (#274848) next »