Yes,
Im trying that with the ereg(..) but it does not work...?? I gives me a error.
Plus it does a gready find...and return the entire string. I would like to extract all links and put it into an array...I want the array to be an array of all links in a webpage.
$theurl + "http://www.yahoo.com";
if(!($fp = fopen($theurl, "r")))
{
echo "Could not open URL";
exit;
}
$contents = fread($fp, 1000000);
fclose($fp);
$pattern = "((http|ftp)://)(([a-z0-9-])+.)(([a-z0-9-])+(.)?)(\/)";
if (eregi($pattern, $contents, $foundurls))
{
echo "The url found is:";
echo $foundurls[1];
} else
{
echo "Cannot any urls";
}
Please help