I am trying to write a script which reads a source page of html and extracts all and any urls that end in an extension type, in this example a jpg.
This is what I have so far:
Code: Select all
$handle = fopen('http://www.awebsite', 'r');
while (!feof($handle)) {
$contents .= fgets($handle);
}
preg_match_all('!http://[\S]+jpg!',"$contents", $matches);
for($x=0; $x<=100; $x++){
print_r($matches[0][$x].'<br>');
}Thanks,
Rob.