cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: how to Post data WITHOUT form?

From: James Dennett <jdennett_at_technocom-wireless.com>
Date: Thu, 1 Nov 2007 13:15:41 -0700

I've reformatted your post to fit accepted standards for messages in
this forum (i.e., with your text after the text to which you responded).
My own note is below.

Tigersoft Development Group wrote:
>
> 2007/11/1, Dan Fandrich <dan_at_coneharvesters.com>:
> > On Thu, Nov 01, 2007 at 07:30:18PM +0200, Tigersoft Development
Group
> wrote:
> > > Hello! I need to post raw data to http://server/page without any
> > > form/field stuff. Just get data from char *data and send it to
server.
> > > After data is sent - I need to get a raw response as char
*response.
> > > Any suggestions? ;/
> >
> > If that's true, you don't need curl--you can do it with netcat. But
> chances
> > are you don't want to send raw data over a socket, you want to send
an
> HTTP
> > POST request, or PUT or something similar, with a specific MIME
type.
> > Once you figure out what kind of request you want, then you can
figure
> out
> > how to do it in libcurl. The chances are high that you'll need the
> > CURLOPT_POSTFIELDS option, though.
> >
>
> I'm writing a C program which needs to send raw data through HTTP
> POST. do you have any example (with netcat too)?

This largely repeats your initial question, whereas you were told that
you need to figure out what kind of request you want to make. People
here will help you, if you do some more of the work and are clearer
about what you are trying to achieve. There are examples of using curl
to post to an HTTP address, and you can get the curl command line tool
to generate C code to show how to post a block of data. If that's not
what you need, you'll have to be more specific.

-- James
Received on 2007-11-01