Hi Guys
I want to write a program that extracts links from a url and then adds them to a mysql database.
I have found some nice examples ie
<?
function getlinks($url) {
$data=file_get_contents($url);
preg_match_all('/(href|src)\=(\"|\')[^\"\'\>]+/i',$data,$media);
unset($data);
$data=preg_replace('/(href|src)(\"|\'|\=\"|\=\')(.*)/i',"$3",$media[0]);
return $data;
}
//now to use the function
echo "<xmp>";
var_dump(getlinks('http://www.google.com.au'));
echo "</xmp>";
?>
Are there other methods that I can use and how do I get the output into a database?
Thank You