cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl and Perl's WWW::Curl::Easy slower than LWP on small HTTP POSTs

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 14 Sep 2011 20:25:53 +0200 (CEST)

On Wed, 14 Sep 2011, Martin J. Evans wrote:

> I'm not sure I can send the form in the same way from WWW::Curl::Easy. It
> only has:
>
> use WWW::Curl::Form;
> my $curlf = WWW::Curl::Form->new;
> $curlf->formaddfile($filename, 'attachment', "multipart/form-data");
> $curlf->formadd("FIELDNAME", "VALUE");
>
> $curl->setopt(CURLOPT_HTTPPOST, $curlf);
>
> See - http://search.cpan.org/~szbalint/WWW-Curl-4.15/lib/WWW/Curl.pm
>
> I don't see a way to control how the form data is added

That is because formadd and CURLOPT_HTTPPOST imply multipart formpost.

If you want plain old application/x-www-form-urlencoded POST then you use
CURLOPT_POSTFIELDS and pass in the string you want sent, pre-formatted by you.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-09-14