cURL / Mailing Lists / curl-users / Single Mail

curl-users

How to get curl to send only errors to a file

From: Scott Haneda <lists_at_newgeo.com>
Date: Wed, 26 Jan 2005 17:50:57 -0800

Hello, I run curl on Mac OS X 10.3.7, I am not sure which version of curl I
am running, I don't think it matters in regards to my question.

If I run:
curl "https://secure1.authorize.net/"
Which is a bad host name, curl sends back to stdout:
curl: (6) Couldn't resolve host 'secure1.authorize.net'

What I want to do, is schedule a cron job to log that error, no matter what
I try to get that error sent to file, I can not, for example:
curl "https://secure1.authorize.net/" > log.txt
When curl works, I get data in the file, when curl errors (6) I get a empty
file.

If someone can help me create a small script that when run, will do nothing
on success and log on error only, that would be most helpful. It would also
be really nice to add in some flags to tell the error to show me the full
trace of the error as well.

I am having intermittent connection issues to a Credit Card processor, since
I always get the hostname error, I want to run a cron script that repeats on
a separate network as well as the main network, this should tell me if I am
having DNS issues or not.

Thank you

-- 
-------------------------------------------------------------
Scott Haneda                                Tel: 415.898.2602
<http://www.newgeo.com>                     Fax: 313.557.5052
<scott_at_newgeo.com>                          Novato, CA U.S.A.
Received on 2005-01-27