Ever needed to get all the urls from a string or a web page? No? Well, here is a script that will do it anyway. Basically it works on grabbbing anything beginning with http, or https, up to the next double comma " or a space. The results are then returned in an array where you can extract them for your use. If you find a better regex to do this, let me know and we will use it.


'<a href=""></a> has many links with
examples <a href="">links</a> to many sites and
even urls without links like just to fill the gaps and
not to forget this one 
which has a space after it. The script has been modifiied from its original so now
it grabs ssl such as also'

 * @get URLs from string (string maybe a url)
 * @param string $string
 * @return array
function getUrls($string)
$regex '/https?\:\/\/[^\" ]+/i';
    return (

$urls getUrls($string);

$urls as $url)
$url.'<br />';


The above script will output a list of urls from the string like this..