cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How do to a post

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 7 Mar 2001 18:16:47 +0100 (MET)

On Wed, 7 Mar 2001, Bescon, Guenole wrote:

> I would like to do a post request
>
> What I've already done is:
>
> curl_easy_setopt(mySession, CURLOPT_POST, 1);
> curl_easy_setopt(mySession, CURLOPT_NOPROGRESS, 1);
> // myURL is a char * that looks like : http://myHost:myPort/myFile
> curl_easy_setopt(mySession, CURLOPT_URL, myURL);
> // myPostedData is a char * that looks like:
> attrname1=attrvalue1&attrname2=attrvalue2&attrname3=attrvalue3....
> curl_easy_setopt(mySession, CURLOPT_POSTFIELDS, myPostedData);
>
> Is it the good way to do a HTTP post using libcurl ?

Yes it looks fine.

> I saw the curl_formparse method. Is it another way to do HTTP post using
> this method ?

Exactly. That is a help function when you want to create a rfc1867-style
post, which is a more complicated and involved multi-part post. If you ever
seen a web page with a file upload form, you've seen one! ;-)

-- 
  Daniel Stenberg -- curl project maintainer -- http://curl.haxx.se/
_______________________________________________
Curl-library mailing list
Curl-library_at_lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/curl-library
Received on 2001-03-07