The Little Guy Posted February 13, 2011 Share Posted February 13, 2011 I am using this to get links from a page: preg_match_all("/href=(\"|')(.+?)(\"|')/", $opt, $matches); $links = $matches[2]; Once in a while I get a link that may look like this: site.com/"><span What can I do to make my regexp better so it doesn't get the html? Link to comment https://forums.phpfreaks.com/topic/227540-grab-links-from-a-page/ Share on other sites More sharing options...
The Little Guy Posted February 17, 2011 Author Share Posted February 17, 2011 anyone? Link to comment https://forums.phpfreaks.com/topic/227540-grab-links-from-a-page/#findComment-1175441 Share on other sites More sharing options...
MasterACE14 Posted February 17, 2011 Share Posted February 17, 2011 strip_tags(); on the result? http://au2.php.net/manual/en/function.strip-tags.php Link to comment https://forums.phpfreaks.com/topic/227540-grab-links-from-a-page/#findComment-1175442 Share on other sites More sharing options...
The Little Guy Posted February 17, 2011 Author Share Posted February 17, 2011 I do that already. I also have noticed that I get results like this too: site.com" class=" Link to comment https://forums.phpfreaks.com/topic/227540-grab-links-from-a-page/#findComment-1175494 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.