cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: get error_state

From: Lars Nilsson <chamaeleon_at_gmail.com>
Date: Mon, 9 Feb 2009 23:08:02 -0500

On Mon, Feb 9, 2009 at 10:31 PM, п⌡п╣п╡я┤п╣п╫п╨п╬ п п╦я─п╦п╩п╩ п║п╣я─пЁп╣п╣п╡п╦я┤
<levchenko.ks_at_nsk.vtb24.ru> wrote:
>
>>This means you need to provide your user name and password using "Basic"
>>authentication to be allowed to get that resource.
>
>>Lookup the -u option!
>
> No, it's for example.
> How me get only error code in variable?
> Server returned error, and variable is empty.
> I want:
> $error=`curl URL`;
> <<HTTP/1.1 [Code error]
> <<....
> print error;
> <<[Code error]
>
> P.S. Sorry my english.

You're looking for the -w / --write-out option, described in the
manual, I think. So perhaps `curl -w '%{http_code}' URL` is what
you're looking for.

Lars Nilsson
-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-02-10