cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: Output to a file

From: Roth, Kevin P. <KPRoth_at_MarathonOil.com>
Date: Wed, 13 Nov 2002 08:44:35 -0500

One way to capture standard-error in your output file is this:

> curl.exe ...(your.arguments.here)... > out.txt 2>&1

The key piece is "2>&1", which redirects standard error (#2) into the same stream as standard out (#1).

I think there's also a command-line flag to turn this behavior on, but I'm not sure what it is.

Another option is to check the EXIT-CODE which curl.exe returns after it's done running. You can examine the batch variable ERRORLEVEL for this number, but be warned that it will change after you run another command. So capture it to your own variable (e.g. SET EXITCODE=%ERRORLEVEL%), and then if it's greater than 0, you had a problem of some kind. curl.exe --manual lists many of the exit codes by number, along with what they mean.

You can find more info on ERRORLEVEL by typing "help if" at a dos prompt under windows 2000.

--Kevin

-----Original Message-----
From: Stamen Gortchev [mailto:s.gortchev_at_onventis.de]
Sent: Wednesday, November 13, 2002 8:05 AM

How is it possible to setup CURL such that to put the result of its operation into a file. I need this because I use curl to upload a file to an IP which is not always "on" - and i need to be sure that the file is uploaded. When the IP is "off", CURL just writes in the Command-Window "..could not resolve host.." - i would like to have this output into a file. I use Windows 2000.

-------------------------------------------------------
This sf.net email is sponsored by: Are you worried about
your web server security? Click here for a FREE Thawte
Apache SSL Guide and answer your Apache SSL security
needs: http://www.gothawte.com/rd523.html
Received on 2002-11-13