curl-and-php
Re: Perl WWW::Curl::Easy equivalent of PHP's CURLOPT_RETURNTRANSFER
Date: Thu, 19 Nov 2009 18:32:53 +0400
Daniel Stenberg wrote:
> On Thu, 19 Nov 2009, admin_at_azuni.net wrote:
>
>> Hello, I couldn't find a Perl mailing list, so excuse me for asking here.
>
> CURLOPT_RETURNTRANSFER was invented by the PHP binding author and is
> basically just a shortcut for appending all received data into a memory
> buffer.
>
> With the C API and basically all existing bindings as well (including
> the PHP one) you can use a write callback to append all data to a single
> buffer.
>
From the tutorial at http://curl.haxx.se/libcurl/c/libcurl-tutorial.html
I guess
size_t write_data(void *buffer, size_t size, size_t nmemb, void *userp);
curl_easy_setopt(easyhandle, CURLOPT_WRITEFUNCTION, write_data);
which in Perl would probably translate to
sub write_data($$$$) { ... }
$curl->setopt(CURLOPT_WRITEFUNCTION, \&write_data);
Can you please tell me how to use that? I know for sure that the
resource that I POST to would only return one line of text as its
response (0 or 1). How can I check for that? WWW::Curl seems to be a
thin Perl wrapper around a .so library, so I don't have the source code
to look at.
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2009-11-19