View Single Post
Old 12-25-2009, 12:52 PM  
calmlikeabomb
Confirmed User
 
calmlikeabomb's Avatar
 
Join Date: May 2004
Location: SW Palm Bay, Florida
Posts: 1,323
Good call on the follow up. I've since started using SIMPLE HTML DOM it's a PHP class that uses jQuery style selectors.

http://simplehtmldom.sourceforge.net/

So the original solution to this thread for accessing all anchor tag "hrefs" can be accomplished like this:

Code:
// Create DOM from URL or file
$html = file_get_html('http://www.google.com/');

// Find & print all link hrefs
foreach($html->find('a') as $element) echo $element->href . '<br>';
It can also be done using an OO style. See the docs for more info. This is a sexy class. Merry XMAS!
__________________
subarus.
calmlikeabomb is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote