I'm using wget in a php script and need to get the name of the file downloaded.
For example, if I try
<?php
system('/usr/bin/wget -q --directory-prefix="./downloads/" http://www.google.com/');
?>
I will get a file called index.html in the downloads directory.
EDIT: The page will not always be google though, the target may be an image or stylesheet, so I need to find out the name of the file that was downloaded.
I'd like to have something like this:
<?php
//Does not work:
$filename = system('/usr/bin/wget -q --directory-prefix="./downloads/" http://www.google.com/');
//$filename should contain "index.html"
?>