jjk2 Posted July 6, 2008 Share Posted July 6, 2008 how can i specify curl to follow each link on a page, and grab a specific results? such as match for all <img> tags ? the first part is only important here. thanks! Link to comment https://forums.phpfreaks.com/topic/113480-using-curl-to-follow-each-links-on-a-page/ Share on other sites More sharing options...
thatsgreat2345 Posted July 6, 2008 Share Posted July 6, 2008 You will have to use regular expressions to get all the links on the page, and once again use regular expressions to grab the images. You will really just need curl to return the output. this should return all links on the page Function _cLinkCollection($HTML) { preg_match_all('/<a[\s]+.*href[\s]*=[\s]*["\\\']([^"\\\']*)["\\\'].*>(.*)<\/a>/miU' ,$HTML,$ar_Links); Return $ar_Links; } Link to comment https://forums.phpfreaks.com/topic/113480-using-curl-to-follow-each-links-on-a-page/#findComment-583088 Share on other sites More sharing options...
jjk2 Posted July 6, 2008 Author Share Posted July 6, 2008 no.... what i meant was how do i make curl click on links, and get those page contents. i can do the regex stuff.....i am interested in how i can make curl navigate into links, output that page content , and supply cookies if necessary to get into the links. Link to comment https://forums.phpfreaks.com/topic/113480-using-curl-to-follow-each-links-on-a-page/#findComment-583108 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.