I pasted the code exactly as you have it, and I got the following:

*Fatal error*: Call to undefined method DOMElement::getContent()

I got the same thing with nodeValue().

On Sun, Aug 16, 2009 at 7:35 AM, Ralph Deffke <ralph_def...@yahoo.de> wrote:

> did u try it something like this
>
> foreach ($links as $link) {
>    $int_url_list[$i]["href"] = $link->getAttribute( 'href' );
>    $int_url_list[$i++]["linkText"] = $link->getContent(  ); // nodeValue();
> }
> that should work
>
> send ur code then please
> ralph_def...@yahoo,de
>
>
> "chrysanhy" <phpli...@hyphusonline.com> wrote in message
> news:88827b190908160033n226b370bqe2ab70732811...@mail.gmail.com...
> > 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="http://X.com";>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 (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to