cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: Outputting HTTP request to a file

From: Roth, Kevin P. <kproth_at_mapllc.com>
Date: Wed, 20 Apr 2005 17:11:14 -0400

I believe it would look like this:

 

    [snip...]

    curl -v --stderr - \

        -s -S

        -d 'item=Rolex+Daytona' \

        -d quantity=$CHAR \

        -d 'price=%A379.99'\

        -d 'buy=BUY' \

        --url http://192.168.0.6/cgi-bin/shopping.cgi >> shopping.txt

        echo -e "***********************************\n\n" >>
shopping.txt

    [/snip...]

 
I replaced -i with the --stderr command, since -i and -v both cause the
response headers to be included.
 
I also added -s (a.k.a. --silent) and -S (a.k.a. --show-error) to
prevent displaying the progress meter but still show any protocol errors
which might be received.
 
 
To answer your second question, yes, I've experimented with the -D
option. Have you?
 
By trying a couple of combinations, I'm seeing that -D will dump the
response headers into a separate file (if "-D filename" is specified) or
include them as part of stdout (if "-D -" is specified). But it doesn't
appear to make the request headers available.
 
- Kevin
 
 
 
________________________________

From: RSN [mailto:rsn_at_rsn.nitrex.net]
Sent: Wednesday, April 20, 2005 4:56 PM

 

 Hi Kevin,

 

Thanks for your reply.

 

I have tried your suggestion but have been unsuccessful in implementing
it correctly.

 

I am new to Curl and am having problems getting to work properly for
application testing.

 

Please could you insert in the correct place the -stderr command in the
following code?

 

quantity=0

while [ $quantity -le 255 ] ; do

        CHAR=`printf "%%%02X" $quantity`

        echo -e "$CHAR *******************************\n\n\n" >>
shopping.txt

curl -v -i \

        -d 'item=Rolex+Daytona' \

        -d quantity=$CHAR \

        -d 'price=%A379.99'\

        -d 'buy=BUY' \ --

        --url http://192.168.0.6/cgi-bin/shopping.cgi >> shopping.txt

        echo -e "***********************************\n\n" >>
shopping.txt

        quantity=`expr $quantity + 1`

done

exit

 

Thanks

 

BTW.: have you experimented with the -D option?
Received on 2005-04-20