4

sorry,.. I'm noob in Ubuntu ... and I'm trying to make a robots for downloading file..

i can download the zip file via web browser's address bar like this

http://www.mysite.com/getFile.php?mirror=1&categori=advanture&file=001.zip

but, when i try to use wget, the file never been downloaded...

this is how i use wget :

$ wget -H http://www.mysite.com/getFile.php?mirror=1&categori=images&file=001.zip
$ wget -H -k http://www.mysite.com/getFile.php?mirror=1&categori=images&file=001.zip
$ wget -H -m http://www.mysite.com/getFile.php?mirror=1&categori=images&file=001.zip
$ wget -H -m -k http://www.mysite.com/getFile.php?mirror=1&categori=images&file=001.zip

all wget just download the php file.. when i open it, it's just
<font color=red>invalid url</font>

does it because of redirect ? or cookie ? when i clear all cookie in mozilla, and download again.. it still wokrs..

or session ? mysite.com is never use login user to download

3 Answers 3

7

You have to use single(') or double quotes(") in URL, so the link should look like this:

$ wget "http://www.mysite.com/getFile.php?mirror=1&categori=images&file=001.zip"
1
  • sorry,.. i accept @elmicha answer.. cause he answer first.. but thanks,... i vot up your answer.. Jun 7, 2011 at 7:17
5

You have to use apostrophes or double quotes around the URL, because it contains the special character &.

1
  • thanks.... i dont know that & is spesial char Jun 7, 2011 at 7:16
-1

Really awesome solution....! It works for me perfectly.

Thanks....

$command = "wget 'URL WITH QUERY STRING'";

exec("$command >/dev/null &");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.