Daniel Stenberg wrote:
>> Can you please tell me how to use that?
>
> Well, I'm not a user of the perl binding but I looked at their package
> and it is strange that I can find them but you obviously can't:
>
> http://cpansearch.perl.org/src/SZBALINT/WWW-Curl-4.09/t/02callbacks.t
>
Thanks! Unit tests, coupled with official documentation, once again
prove to be the best howto on how to use the thing:
my $response;
sub write_data($$$$) {
$response = shift;
return length($response);
}
$curl->setopt(CURLOPT_POSTFIELDS, $data);
$curl->setopt(CURLOPT_URL,
'https://example.com/path/to/script');
$curl->setopt(CURLOPT_VERBOSE, 1);
$curl->setopt(CURLOPT_POST, 1);
$curl->setopt(CURLOPT_SSLVERSION, 3);
$curl->setopt(CURLOPT_SSL_VERIFYPEER, 0);
$curl->setopt(CURLOPT_HEADER, 0);
$curl->setopt(CURLOPT_WRITEFUNCTION, \&write_data);
$curl->perform();
print STDERR "got response: '$response'\n";
Working like a charm without using any CURLOPT_WRITEDATA.
_______________________________________________
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.