Download file using curl from php server

I am trying to write a script that will download all the source material from tutorials on lazyfoo.net. Example file download link

http://lazyfoo.net/downloads/index.php?file=SDLTut_lesson16

I use this command:

curl http://lazyfoo.net/downloads/index.php?file=SDLTut_lesson13 --O lesson13.zip

This gives me this answer and no file:

 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                Dload  Upload   Total   Spent    Left  Speed
 0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

Am I missing something obvious?

+5
source share
1 answer

You get a 302 redirect. Use the option -L

curl http://lazyfoo.net/downloads/index.php?file=SDLTut_lesson13 -L --O lesson13.zip

Also in the future -v(means verbose) is useful for debugging.

+6
source

All Articles