CURL output to file

Is it possible to direct this output from cURL to a file?

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1354  100  1354    0     0  17358      0 --:--:-- --:--:-- --:--:-- 17358
100 67081  100 67081    0     0  68171      0 --:--:-- --:--:-- --:--:-- 4031k

I cannot find anything in --helpthat indicates that you can. -ojust made an answer from what I can say.

I just want to find out if the request succeeded and how much time has passed.

+4
source share
2 answers

This output is sent to stderr. So, to get everything you need, redirect stream 2 (stderr) to a file as

curl -o responseFile.html http://www.somewhere.com 2> informationFile.txt

But, as your capture shows, times do not always turn on.

, , - curl . -w. ,

curl -o responseFile.html http://www.somewhere.com -w "%{response_code};%{time_total}" > dataFile.txt 2> informationFile.txt

, responseFile.html( ), (stderr stream 2) informationFile.txt, dataFile. TXT

+12

, :

curl -o gettext.html http://www.gnu.org/software/gettext/manual/gettext.html 2> details.txt

URL- gettext.html details.txt.

+4

All Articles