Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Download a file using curl from a php server [closed]

Tags:

curl

I'm trying to write a script that will download all the source material from the tutorials at lazyfoo.net. An example download link for the file is

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 gets me this response 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?

like image 376
Bryan Glazer Avatar asked Feb 03 '12 02:02

Bryan Glazer


1 Answers

You are getting a 302 redirect. Use the -L option

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

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

like image 93
Gareth A. Lloyd Avatar answered Oct 14 '22 00:10

Gareth A. Lloyd