cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Responce to a HTTP Post

From: Raquel Vieira <raquel.vieira_at_ent.efacec.pt>
Date: Tue, 8 Nov 2005 17:12:15 -0000

Thanks very much.
It worked fine.

Raquel Vieira

-----Original Message-----
From: man_at_tfhs.net [mailto:man_at_tfhs.net]
Sent: terça-feira, 8 de Novembro de 2005 15:40
To: libcurl development
Subject: Re: Responce to a HTTP Post

On Tue, Nov 8, 2005, Raquel Vieira <raquel.vieira_at_ent.efacec.pt> said:

> Hi.
>
> I'm doing a HTTP Post using libcurl.
>
>
>
> I'm using the following options:
>
> curl_easy_setopt (httpHandle, CURLOPT_URL, url.c_str ());
>
> curl_easy_setopt (httpHandle, CURLOPT_POST, 1);
>
> curl_easy_setopt (httpHandle, CURLOPT_POSTFIELDS, postData.c_str());
>
>
>
>
>
> When I do thw post, the server answers with OK/NOK and I need to get the
> answer.
>
> How can I do that?

setup a write call back.....

size_t
httpWriteCallback(void *ptr, size_t size, size_t nmemb, void *data)
{
  int realsize = size * nmemb;
 
  //buffer data from ptr to data

  return realsize;
}

then install it...

curl_easy_setopt(mycurl, CURLOPT_WRITEFUNCTION, httpWriteCallback);
curl_easy_setopt(mycurl, CURLOPT_WRITEDATA, (void *)&resp);

then after you perform(), look in 'resp'

allan

>
>
>
> Thanks in advance for the help,
>
>
>
> Raquel Vieira
>
>
>
>

-- 
m. allan noah
IT Director, TfHS.net
ph# (804) 355-5489
tf# (866) 724-9722
fx# (804) 355-0477
Received on 2005-11-08