d_barszczak Posted June 28, 2007 Share Posted June 28, 2007 Hi all, I am developing a simple seach engine script that puts words found in a html document into a table notes the url and the occourances. What i would like it to do is find any hyperlinks that are in the html document and im not sure how to pick out the hyperlinks and place them in an array. Link to comment https://forums.phpfreaks.com/topic/57541-parsing-text/ Share on other sites More sharing options...
effigy Posted June 28, 2007 Share Posted June 28, 2007 <pre> <?php $html = <<<HTML <ul> <li><a href="http://www.google.com">Google</a></li> <li><a href="http://www.letspolka.com">Let's Polka</a></li> <li><a href='http://www.neatorama.com'>Neatorama</a></li> <li><a href=http://www.phpfreaks.com>PHP Freaks</a></li> </ul> HTML; preg_match_all('/(?<=href=)[\'"]?([^\s"\'>]+)/', $html, $matches); array_shift($matches); print_r($matches); ?> </pre> Link to comment https://forums.phpfreaks.com/topic/57541-parsing-text/#findComment-284833 Share on other sites More sharing options...
d_barszczak Posted July 27, 2007 Author Share Posted July 27, 2007 Thank you, I like to try do things myself first but i have been scratching my head for weeks now. Kinda gutted you answered is so quickly. Thanks Again. Link to comment https://forums.phpfreaks.com/topic/57541-parsing-text/#findComment-308667 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.