dose Posted July 16, 2009 Share Posted July 16, 2009 its been racking my brain for about a week now. im still pretty new to php but ive ask my friend the same question and he cant tell me the reason so hope someone here can figure it out.. Im using cURL to get the contents of another site I.E stats from a server. im using preg_match_all("/<div class=\"ep_stat_top_stats_row_right\">(.*?)<\/div>/", $html, $matches); $bah = $matches['0']; print_r($bah); to try and match whats between these tags <div class="ep_stat_top_stats_row_right"> 250 </div> everytime i try this i just get a blank array back if i echo the $html i do get the full page displaying everything i am trying to grab. So im not to sure what the problem could be. Quote Link to comment https://forums.phpfreaks.com/topic/166180-solved-preg_match_all-no-results/ Share on other sites More sharing options...
MadTechie Posted July 16, 2009 Share Posted July 16, 2009 if (preg_match('%<div class="ep_stat_top_stats_row_right">(.*?)</div>%si', $html, $matches)) { $bah = $matches[1]; Use the S modifier (dot matches new lines) EDIT: oops forgot to add a match_all example.. (same idea) preg_match_all('%<div class="ep_stat_top_stats_row_right">(.*?)</div>%si', $html, $matches); EDIT #2: And Welcome to PHP Freaks Quote Link to comment https://forums.phpfreaks.com/topic/166180-solved-preg_match_all-no-results/#findComment-876326 Share on other sites More sharing options...
dose Posted July 16, 2009 Author Share Posted July 16, 2009 Thanks that did the trick. was buggin me for so long to why it wasnt workin Quote Link to comment https://forums.phpfreaks.com/topic/166180-solved-preg_match_all-no-results/#findComment-876336 Share on other sites More sharing options...
MadTechie Posted July 16, 2009 Share Posted July 16, 2009 the i means ignore case can you click topic solved please Quote Link to comment https://forums.phpfreaks.com/topic/166180-solved-preg_match_all-no-results/#findComment-876338 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.