cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: Web service server doesn't see posted data

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 11 Apr 2008 10:45:44 +0200 (CEST)

On Thu, 10 Apr 2008, Bruce, Henry wrote:

>> The difference between the first and second commands is that the first does
>> a POST while the second does a GET. Add the -G option to the first one and
>> it should work.

> However when I generated the libcurl source, I saw that the --get command
> caused the post field data to be added to the URL. This implies that I
> cannot use the curl_easy_setopt CURLOPT_POSTFIELDS option to set the web
> service query string, but must append it to the url (as per the working
> example above). This will work, but it makes the libcurl code messier. I
> tried setting the CURLOPT_HTTPGET parameter to 1, but this failed as before.
> Is there any way I can use the CURLOPT_POSTFIELDS option, or I must I create
> the URI myself and use it as paramter for the CURLOPT_URL option ?

Now we took a large step into the land of libcurl and thus this is now rather
a subject for the curl-library list...

But you're right. When you do a POST you provide the data to the
CURLOPT_POSTFIELDS option and when you do a GET the entire data is passed in
the URL. libcurl works this way because this is how HTTP URLs are designed to
work and doing it any other way would be highly confusing if you ask me.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2008-04-11