Re: Perl WWW::Curl::Easy equivalent of PHP's CURLOPT_RETURNTRANSFER

[email protected]
Newsgroups gmane.comp.web.curl.php
Organization UniNet
Message-ID <[email protected]>
Daniel Stenberg wrote:
> On Thu, 19 Nov 2009, [email protected] 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.