cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to pass custom data on top of HTTP GET

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 28 Dec 2010 23:08:06 +0100 (CET)

On Tue, 28 Dec 2010, amit paliwal wrote:

> I want to pass additional custom data on top of HTTP GET to the HTTP Server,
> which means I need to build HTTP GET message including the payload and send
> it to HTTP Server by saying curl_easy_perform().
>
> Do I need to use CURLOPT_READFUNCTION option and maintain one callback
> function where i can append my custom data? But then how will the library
> call my custom payload and send it on top of HTTP GET.

Make the request out to be a POST, like use CURLOPT_POSTFIELDS or
CURLOPT_READFUNCTION or whatever you think is the best way.

Then you alter the method to a GET with CURLOPT_CUSTOMREQUEST and you should
be good to go. You may want to remove/alter the "Content-Type:" that a mere
POST will make libcurl use by default (use CURLOPT_HTTPHEADER for that).

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-12-28