How can I download all files of a specific type from a website using PHP?
- by CheeseConQueso
I want to get all midi (*.mid) files from a site that's set up pretty simple in terms of directory tree structure. I wish we had wget installed here, but that's another party....
The site is VGMusic.com and the path containing all of the midi files is:
http://www.vgmusic.com/music/console/nintendo/nes/
I tried glob'ing it out, but I suppose that glob only works locally?
Here is what I wrote to try to make it happen (doesn't work.. obviously..):
<?php
echo 'not a blizzard<br>';
foreach(glob('http://www.vgmusic.com/music/console/nintendo/nes/*.mid') as $filename)
{
echo $filename.'<br>';
//$newfile = 'http://www.mydomain.com/nes/'.$filename;
//copy($filename, $newfile)
}
?>
I tried it also without the http:// in there with no luck.