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... Quote 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 Quote 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... Quote Link to comment https://forums.phpfreaks.com/topic/169668-solved-fetching-remote-data/#findComment-895158 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.