I'm trying to get all urls from this string:
2014 urmymuse Licensed to the public under http://creativecommons.org/licenses/by/3.0/ Verify at http://ccmixter.org/files/urmymuse/47486
I tried with:
$url_str = "";
$matches = preg_match_all('#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#i', $str, $urls);
if ($matches) {
foreach ($urls as $url) {
$urls_str = $urls_str . ' ' . $url[0];
}
}
But outcome is: " http://creativecommons.org/licenses/by/3.0/ /" instead of the awaited two urls. What I'm doing wrong?