PHPNewbie55 Posted August 10, 2009 Share Posted August 10, 2009 Here is my code... $data = file_get_contents("http://www.someurl.com/"); preg_match('/">.*?<\/a><\/li>/',$data, $matches); $fetchedtext = "".str_replace("\">", "", str_replace("</a></li>", "", $matches[0])).""; print "$fetchedtext"; Here is my question: This code only prints one set of "fetched text"... is there a way to get this to loop through the page and get all instances..?? I have tried a "while" but it just grabs the same data over and over again... never ending.. Just curious.. Any help would be appreciated... Link to comment https://forums.phpfreaks.com/topic/169668-solved-fetching-remote-data/ Share on other sites More sharing options...
GingerRobot Posted August 10, 2009 Share Posted August 10, 2009 You'll need preg_match_all, rather than preg_match Link to comment https://forums.phpfreaks.com/topic/169668-solved-fetching-remote-data/#findComment-895121 Share on other sites More sharing options...
PHPNewbie55 Posted August 10, 2009 Author Share Posted August 10, 2009 It is always so simple.... LOL... just not for me. Thank you... Link to comment https://forums.phpfreaks.com/topic/169668-solved-fetching-remote-data/#findComment-895158 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.