I need a script that collects all URLs (even those that aren't visble in the source code - like those generated by javascript or other scripts) from a webpage and save them to databse.
Someone else gave me this:
<?php
$subject = file_get_contents("http://google.com/");
$search = '(\b[a-zA-Z0-9]+://[^( |\>)]+\b)';
preg_match_all($search, $subject, $matches);
foreach($matches as $key => $value){
print "match found in url " . print_r($value) . "<br/>";
}
?>
...but it doesn't get all URLs and it doesnt get URLs generated by Javascript or other scripts.
Your help will be greatly appreciated.