cURL / Mailing Lists / curl-library / Single Mail

curl-library

How to save response?

From: <conversions_at_q2q.us>
Date: Wed, 31 Jul 2013 14:31:41 -0500

I am executing curl.exe using windows Shell command. The request is successful based on the --trace-ascii response to a file.

How can I save just the response to a file?

trace-ascii shows the following.

== Info: Adding handle: conn: 0xbcbd08
== Info: Adding handle: send: 0
== Info: Adding handle: recv: 0
== Info: Curl_addHandleToPipeline: length: 1
== Info: - Conn 0 (0xbcbd08) send_pipe: 1, recv_pipe: 0
== Info: About to connect() to api.sandbox.paypal.com port 443 (#0)
== Info: Trying 173.0.82.78...
== Info: Connected to api.sandbox.paypal.com (173.0.82.78) port 443 (#0)
== Info: SSLv3, TLS handshake, Client hello (1):
=> Send SSL data, 232 bytes (0xe8)
0000: ......Q.d.!.....Z.H....1..g..)..D.....\.....9.8.........5.....
0040: ................3.2.....E.D...../...A...........................
0080: ........_.........api.sandbox.paypal.com...........4.2..........
00c0: ........................................
== Info: SSLv3, TLS handshake, Server hello (2):
<= Recv SSL data, 81 bytes (0x51)
0000: ...M...o..(xn.>...$...h7.W.c...nx..|.. R...2.p.A...u....@.+..}.U
0040: HM...$...........
== Info: SSLv3, TLS handshake, CERT (11):
<= Recv SSL data, 5164 bytes (0x142c)
0000: ...(..%..V0..R0..:.........@..y<?.&....0.0...*.H........0..1.0..
0040: .U....US1.0...U....VeriSign, Inc.1.0...U....VeriSign Trust Netwo
0080: rk1;09..U...2Terms of use at https://www.verisign.com/rpa (c)101
00c0: /0-..U...&VeriSign Class 3 Secure Server CA - G30...121206000000
0100: Z..161206235959Z0..1.0...U....US1.0...U....California1.0...U....
0140: San Jose1.0...U....PayPal, Inc.1.0...U....PayPal Production1.0..
0180: .U....api.sandbox.paypal.com0.."0...*.H.............0...........
01c0: .k.).Tw..N.x......%...4.......\.L.......P.[W...#...e.a..z......9
0200: t.A/..(.D-...s..CK..$g....... +Q.....^$Fq[...].....P.('TlH.j..5[
0240: .\...#..,.}.\P^.#)$..&} ..0...C.`......w..MdMW....9.Z.x40.w...$.
0280: .+.;~D..~.x2n...#.,...Kl]}W&.7.M'.&...A......Q..0.Y...j..>.....
02c0: ......0...0!..U....0...api.sandbox.paypal.com0...U....0.0...U...
0300: ........0E..U...>0<0:.8.6.4http://SVRSecure-G3-crl.verisign.com/
0340: SVRSecureG3.crl0C..U. .<0:08..`.H...E..60*0(..+.........https://
0380: www.verisign.com/cps0...U.%..0...+.........+.......0...U.#..0...
03c0: .D\.SD..~. .%..c..y.0v..+........j0h0$..+.....0...http://ocsp.ve
0400: risign.com0@..+.....0..4http://SVRSecure-G3-aia.verisign.com/SVR
0440: SecureG3.cer0...*.H.............QwhWI.+.S...we...(.......b.....u
0480: _..X._at_i4.......WsF8.?/.1......-.....{.3...WGj.......$.qJ..-`....
04c0: 2\.....Fn..(C......</f....=.7.).6..$..w...y....#..l.g..C.R...Q..
0500: ./%....z..,B9.&...^f.U./..[.qn..O...1y.I...h..w.V.......n..8...2
0540: q ....M..2.....yS.....V.......2....0...0..........n.z... ......R
0580: ..0...*.H........0..1.0...U....US1.0...U....VeriSign, Inc.1.0...
05c0: U....VeriSign Trust Network1:08..U...1(c) 2006 VeriSign, Inc. -
0600: For authorized use only1E0C..U...<VeriSign Class 3 Public Primar
0640: y Certification Authority - G50...100208000000Z..200207235959Z0.
0680: .1.0...U....US1.0...U....VeriSign, Inc.1.0...U....VeriSign Trust
06c0: Network1;09..U...2Terms of use at https://www.verisign.com/rpa
0700: (c)101/0-..U...&VeriSign Class 3 Secure Server CA - G30.."0...*.
0740: H.............0..............E...%....>....9.....V...e.DOM.o..J.
0780: .N..h...{.....44..[.I{b.H.t..xl.S..C&WX3.;3....N.$..}d..tJ4....
07c0: ......K;.c...-.......=..7..H5.)Px.Ec..AO...{...q.P.(....S...,#..
0800: .......<n....56.Q.i...Vno.W........JTj.M......g..DU3.$.?SE...<
0840: .m...J...7.......{8N...........0...04..+........(0&0$..+.....0.
0880: ..http://ocsp.verisign.com0...U.......0.......0p..U. .i0g0e..`.H
08c0: ...E....0V0(..+.........https://www.verisign.com/cps0*..+.......
0900: 0...https://www.verisign.com/rpa04..U...-0+0).'.%.#http://crl.ve
0940: risign.com/pca3-g5.crl0...U...........0m..+........a0_.].[0Y0W0U
0980: ..image/gif0!0.0...+..............k...j.H.,{..0%.#http://logo.ve
09c0: risign.com/vslogo.gif0(..U...!0...0.1.0...U....VeriSignMPKI-2-60
0a00: ...U.......D\.SD..~. .%..c..y.0...U.#..0....e......0..C9...3130
0a40: ...*.H...............$.....X..6....K......S........X.ul...L...-.
0a80: ..n."pU. 3_at_3..e...C7....lp....;.7.zm...}IJ....(...w$..&.m.._at_Ag.'
0ac0: :..H.".......{.....v*..-.nt...."....+....\.P....b7..e..AS.....X(
0b00: ...[...J....&..fx.J..B....B....g$.a......&...n..u.F....^.....G.
0b40: ..(l%'....X..8....f...0...0..2.......zO.W.g4.{ XF.G.E0...*.H....
0b80: ....0..1.0...U....US1.0...U....VeriSign, Inc.1<0:..U...3Class 3
0bc0: Public Primary Certification Authority - G21:08..U...1(c) 1998 V
0c00: eriSign, Inc. - For authorized use only1.0...U....VeriSign Trust
0c40: Network0...061108000000Z..211107235959Z0..1.0...U....US1.0...U.
0c80: ...VeriSign, Inc.1.0...U....VeriSign Trust Network1:08..U...1(c)
0cc0: 2006 VeriSign, Inc. - For authorized use only1E0C..U...<VeriSig
0d00: n Class 3 Public Primary Certification Authority - G50.."0...*.H
0d40: .............0.........$..)z5.`...K;N.|.<E..+..)..W..d..'....1.]
0d80: ".*..B....U...K...~.W..C.fb.a.`.......b.=T..I.YT.&.+........3I.C
0dc0: cjRK...pQM..i{.p....t.{]KV....w....%....g............:......<...
0e00: .7........=..u.3...@.t$.!.....*R....I..cG.<i...G.+~O.......C.gs.
0e40: ..~.?.s.3..]?4....S.%.........10..-0...U.......0....0...U.......
0e80: ....0=..U. .60402..U. .0*0(..+.........https://www.verisign.com/
0ec0: cps0...U.......e......0..C9...3130m..+........a0_.].[0Y0W0U..im
0f00: age/gif0!0.0...+..............k...j.H.,{..0%.#http://logo.verisi
0f40: gn.com/vslogo.gif04..U...-0+0).'.%.#http://crl.verisign.com/pca3
0f80: -g2.crl0...U.%..0...+.........+.......0....U.#...0........0..1.0
0fc0: ...U....US1.0...U....VeriSign, Inc.1<0:..U...3Class 3 Public Pri
1000: mary Certification Authority - G21:08..U...1(c) 1998 VeriSign, I
1040: nc. - For authorized use only1.0...U....VeriSign Trust Network..
1080: }........yg...4.0...*.H............'.....i...F..6......._.-.....
10c0: ...i.;,5I......#...X...E[pI......''^x.4. E.}....N.<hE..{..x.5m.
1100: x}.Nt....7D75..8".....wD6j.E..........0...0..k..}........yg...4.
1140: 0...*.H........0..1.0...U....US1.0...U....VeriSign, Inc.1<0:..U.
1180: ..3Class 3 Public Primary Certification Authority - G21:08..U...
11c0: 1(c) 1998 VeriSign, Inc. - For authorized use only1.0...U....Ver
1200: iSign Trust Network0...980518000000Z..280801235959Z0..1.0...U...
1240: .US1.0...U....VeriSign, Inc.1<0:..U...3Class 3 Public Primary Ce
1280: rtification Authority - G21:08..U...1(c) 1998 VeriSign, Inc. - F
12c0: or authorized use only1.0...U....VeriSign Trust Network0..0...*.
1300: H............0.......^..]\i....jL..Y.0... FmG?.. ..m........;...
1340: %....c.|c..G..[3.d@.h...d.Ew..n..)<P.4.x...mC...EW^~........7T0o
1380: ..G23..W.dia.....O\g.....0...*.H............QM..\.......9x.M.gpp
13c0: ...Z..SMTm+..]@.d....Va._....a6.,'<.)...dt..s..H..a.......@.;...
1400: Ds*..i..q..9.q...o.q...YW&y.....30(..X...i..
== Info: SSLv3, TLS handshake, Request CERT (13):
<= Recv SSL data, 639 bytes (0x27f)
0000: ...{...w..0..1.0...U....US1.0...U....California1.0...U....San Jo
0040: se1.0...U....PayPal, Inc.1.0...U....sandbox_certs1.0...U....sand
0080: box_camerchapi1.0...*.H........re_at_paypal.com..0..1.0...U....US1.
00c0: 0...U....California1.0...U....San Jose1.0...U....PayPal, Inc.1.0
0100: ...U....stage1_certs1.0...U....stage1_camerchapi1.0...*.H.......
0140: .re_at_paypal.com..0..1.0...U....US1.0...U....CA1.0...U....San Jose
0180: 1.0...U....PayPal Inc.1,0*..U...#Mobile Client Certificate Autho
01c0: rity1!0...U....PayPal Sandbox Client CA1301..*.H.......$DL-PP-Ap
0200: plicationSecurity_at_paypal.com.a0_1.0,..U...%gtorel_1310486522_per
0240: _api1.paypal.com1.0...U....Napoli1.0...U....Napoli1.0...U....IT
== Info: SSLv3, TLS handshake, Server finished (14):
<= Recv SSL data, 4 bytes (0x4)
0000: ....
== Info: SSLv3, TLS handshake, CERT (11):
=> Send SSL data, 7 bytes (0x7)
0000: .......
== Info: SSLv3, TLS handshake, Client key exchange (16):
=> Send SSL data, 262 bytes (0x106)
0000: ......9......DER..u@.K..\.......u..H...^..v4sb2.C.....8N.w...4..
0040: M.. +.&Kj....:...df?.?s...Et.*....z...b.6+.......[3"$+..2....:.5
0080: .............n...........]5u[I.....9...N.~|...B..X....{...O..Y
00c0: h..................j.F._at_4?..H..(..;.Ggvf'..........m...L.9..Z.Y.
0100: ...g..
== Info: SSLv3, TLS change cipher, Client hello (1):
=> Send SSL data, 1 bytes (0x1)
0000: .
== Info: SSLv3, TLS handshake, Finished (20):
=> Send SSL data, 16 bytes (0x10)
0000: ....P...Z.7.....
== Info: SSLv3, TLS change cipher, Client hello (1):
<= Recv SSL data, 1 bytes (0x1)
0000: .
== Info: SSLv3, TLS handshake, Finished (20):
<= Recv SSL data, 16 bytes (0x10)
0000: .......p.k.&.,..
== Info: SSL connection using DES-CBC3-SHA
== Info: Server certificate:
== Info: subject: C=US; ST=California; L=San Jose; O=PayPal, Inc.; OU=PayPal Production; CN=api.sandbox.paypal.com
== Info: start date: 2012-12-06 00:00:00 GMT
== Info: expire date: 2016-12-06 23:59:59 GMT
== Info: issuer: C=US; O=VeriSign, Inc.; OU=VeriSign Trust Network; OU=Terms of use at https://www.verisign.com/rpa (c)10; CN=VeriSign Class 3 Secure Server CA - G3
== Info: SSL certificate verify result: self signed certificate in certificate chain (19), continuing anyway.
== Info: Server auth using Basic with user 'AfAdCRAUUCJM6RpFv4_eJvaNBCYSL_x7u4_OkMte5xdAgse82loUh-dHk4C-'
=> Send header, 395 bytes (0x18b)
0000: POST /v1/oauth2/token HTTP/1.1
0020: Authorization: Basic QWZBZENSQVVVQ0pNNlJwRnY0X2VKdmFOQkNZU0xfeDd
0060: 1NF9Pa010ZTV4ZEFnc2U4MmxvVWgtZEhrNEMtOkVCbk1aUkFYZUpsT04ySEZ5Zjg
00a0: 5MUlrYUJRSmxqTWFOaDBrY3RPVEF2akFHbHJyNjhBU19DdS1QV3dyZw==
00db: User-Agent: curl/7.31.0
00f4: Host: api.sandbox.paypal.com
0112: Accept: application/json
012c: Accept-Language: en_US
0144: Content-Length: 29
0158: Content-Type: application/x-www-form-urlencoded
0189:
=> Send data, 29 bytes (0x1d)
0000: grant_type=client_credentials
== Info: upload completely sent off: 29 out of 29 bytes
<= Recv header, 17 bytes (0x11)
0000: HTTP/1.1 200 OK
== Info: Server Apache-Coyote/1.1 is not blacklisted
<= Recv header, 27 bytes (0x1b)
0000: Server: Apache-Coyote/1.1
<= Recv header, 37 bytes (0x25)
0000: Date: Wed, 31 Jul 2013 19:22:34 GMT
<= Recv header, 32 bytes (0x20)
0000: PayPal-Debug-Id: a93c6371feaec
<= Recv header, 32 bytes (0x20)
0000: Content-Type: application/json
<= Recv header, 21 bytes (0x15)
0000: Content-Length: 282
<= Recv header, 2 bytes (0x2)
0000:
<= Recv data, 282 bytes (0x11a)
0000: {"scope":"https://api.paypal.com/v1/payments/.* https://api.payp
0040: al.com/v1/vault/credit-card https://api.paypal.com/v1/vault/cred
0080: it-card/.* openid","access_token":"LpPjTiXAuS.Vls6ahjX8Xje.Jb0O5
00c0: Fxt3zk0T8-R.mk","token_type":"Bearer","app_id":"APP-80W284485P51
0100: 9543T","expires_in":28800}
== Info: Connection #0 to host api.sandbox.paypal.com left intact

I only need the following part of the response

0000: {"scope":"https://api.paypal.com/v1/payments/.* https://api.payp
0040: al.com/v1/vault/credit-card https://api.paypal.com/v1/vault/cred
0080: it-card/.* openid","access_token":"LpPjTiXAuS.Vls6ahjX8Xje.Jb0O5
00c0: Fxt3zk0T8-R.mk","token_type":"Bearer","app_id":"APP-80W284485P51
0100: 9543T","expires_in":28800}

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-07-31