im not shure which one works on an image link which is indeed a child of <a
so u could also check if the node has a child, if so its an image with, in
good practice. an alt attribute to use

haven't tried but should work. let me know pls

"chrysanhy" <> wrote in message
> I have the following code to extract the URLs from the anchor tags of an
> HTML page:
> $html = new DOMDocument();
> $htmlpage->loadHtmlFile($location);
> $xpath = new DOMXPath($htmlpage);
> $links = $xpath->query( '//a' );
> foreach ($links as $link)
> { $int_url_list[$i++] = $link->getAttribute( 'href' ) . "\n"; }
> If I have a link <a href="";>YYYY</a>, how do I extract the
> corresponding YYYY which is displayed to the user as the text of the link
> (if it's an image tag, I would like a DOMElement for that).
> Thanks

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to