Re: [PHP] Re: How do I extract link text from anchor tag as well as the URL from the "href" attribute

2009-08-16 Thread chrysanhy
the 2 files directly in a minute. it came out, as I thought > earlier that u have to check if the tags has got children to extract > image links. > > ralph_def...@yahoo.de > > > "chrysanhy" wrote in message > news:88827b190908160943t2254137fve43771c7e4f8c..

Re: [PHP] Re: How do I extract link text from anchor tag as well as the URL from the "href" attribute

2009-08-16 Thread chrysanhy
but I cannot get the code to find the URL in the HTML. While I still hope for a DOM solution to getting this link text, WHY can't the code find the URL in the HTML snippet? On Sun, Aug 16, 2009 at 9:29 AM, chrysanhy wrote: > I pasted the code exactly as you have it, and I got the following

Re: [PHP] Re: How do I extract link text from anchor tag as well as the URL from the "href" attribute

2009-08-16 Thread chrysanhy
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 > > > &q

Re: [PHP] Re: How do I extract link text from anchor tag as well as the URL from the "href" attribute

2009-08-16 Thread chrysanhy
ndeed a child of 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 > > ralph_def...@yahoo.de > > > "chrysanhy" wrote in message > news:88827b

[PHP] How do I extract link text from anchor tag as well as the URL from the "href" attribute

2009-08-16 Thread chrysanhy
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' ) . "\