cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: How do I do this?

From: Roth, Kevin P. <kproth_at_mapllc.com>
Date: Thu, 16 Jun 2005 08:40:25 -0400

The -G flag is intended for those situations where you're ONLY doing a
GET, yet you want to use the -d parameter to attach your parameters,
possibly one at a time, and let curl put them together for you. By
specifying that string, you've instructed cURL to turn your
--data-binary (or --data, or --data-ascii) file into a GET parameter.
 
In your case, I believe you need something a little closer to:
 
/opt/bin/curl -v --trace-ascii - --max-time 15 -o test.out
--url
"http://xx.xx.80.249:19710?page=1&type=g&scale=100&width=0&height=0&leng
th=6497
"
--data-binary @O205893.pdf

The keys are:

1. Leave off the -G

2. Include the "get" parameters as part of the URL string.

3. Continue using --data-binary with the "@" in front as you suspected.

- Kevin
 

p.s., Daniel - would a (non-ascii-encoded) binary file ever make sense
embedded in the URL as is happening in this case? If not, you might
consider making --data-binary ignore the -G flag and let it do a
MIME-encoded POST no matter what.

________________________________
From: curl-users-bounces_at_cool.haxx.se
[mailto:curl-users-bounces_at_cool.haxx.se] On Behalf Of Chris Glon
Sent: Wednesday, June 15, 2005 1:41 PM

> I am having trouble with sending the following GET request. The GET
> request is supposed to be made of a 128 character string (right space
> padded) followed immediately by the contents of a PDF file, i.e binary

> data.
 
> I tried it many ways but to no avail. At this stage, I am encountering

> two issues: 1- An ampersand is placed between the string and the file
> contents.2- When doing a get, it seems that cURL uploads the contents
> up to the very first newline only (See trace below).
 
> Here is my latest try:
 
> /opt/bin/curl -G -v --trace-ascii - --max-time 15 -o test.out
> --url http://xx.xx.80.249:19710 -d "page=1&type=g&scale=100
> &width=0&height=0&length=6497..." --data-binary @O205893.pdf

> I had to use the -G because I could not build a request that contained

> the 128 char string and the file upload in the same request.
 
Received on 2005-06-16