happyturtle Posted February 20, 2010 Share Posted February 20, 2010 function getUrls($string) { $regex = '/http?\:\/\/[^\" ]+/i'; preg_match_all($regex, $string, $matches); return ($matches[0]); } $urls = getUrls($_POST["code"]); foreach($urls as $url) { echo $url.'<br />'; } The code above get all links. I want it to get only link with megaupload.com in them. Is that possible? Thanks. Link to comment https://forums.phpfreaks.com/topic/192696-simple-fix-i-think/ Share on other sites More sharing options...
jl5501 Posted February 20, 2010 Share Posted February 20, 2010 foreach($urls as $url) { if(!strpos($url,'megaupload.com')) continue; echo $url.'<br />'; } Link to comment https://forums.phpfreaks.com/topic/192696-simple-fix-i-think/#findComment-1015172 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.