foreach($xpath->query('//link') as $l){
$url=parse_url($l->getAttribute("href"));
- echo print_r($url);
$file = '/home/reddit/assets/'. $url["host"] . $url["path"];
if(file_exists($file)){
echo "file exists already.\n";
file_put_contents($file,$contents);
}
- $x=0;
foreach($xpath->query('//img') as $im){
- echo "\$x=".$x++."\n";
$url=parse_url($im->getAttribute("src"));
- echo "\n\n".print_r($im->getAttribute("src"))."\n\n";
$file = '/home/reddit/assets/'. $url["host"] . $url["path"];
if(file_exists($file)){
echo "file exists already.";