wget return downloaded filename
Posted
by Matthew
on Stack Overflow
See other posts from Stack Overflow
or by Matthew
Published on 2010-03-23T05:36:25Z
Indexed on
2010/03/23
5:43 UTC
Read the original article
Hit count: 465
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. The page will not always be google though, 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"
?>
© Stack Overflow or respective owner