in reply to Cannot suppress Curl headers

You have to set the CURLOPT_HEADERDATA and CURLOPT_WRITEDATA options. My testing indicates that their default value is STDOUT:
my $response_data; my $response_header; open(my $RD, ">", \$response_data); open(my $RH, ">", \$response_header); ... $curl->setopt(CURLOPT_WRITEDATA, $RD); $curl->setopt(CURLOPT_HEADERDATA, $RH); ... $curl->perform; print "Response header: $response_header\n"; print "Response body: $response_body\n";
Unforunately it doesn't seem you can use undef for these options.

Some more testing indicates that CURLOPT_HEADER option determines whether or not the headers are copied through the CURLTOP_WRITEDATA handle as well as through the CURLOPT_HEADERDATA handle.

Replies are listed 'Best First'.
Re^2: Cannot suppress Curl headers
by RSI_Don (Initiate) on May 29, 2008 at 19:20 UTC
    Regrettably, those don't work. 1) use strict complains about those options. 2) I get 'use of uninitialized value in open' errors for opening the two filehandles. 3) $response_data comes back empty.
      What version of libcurl and WWW::Curl are you using? My test script works fine with use strict.

      Also, check your WWW::Curl documentation. I just installed the latest version, and that's where I got the idea about setting CURLOPT_WRITEDATA, etc.

        Client server on which I'm trying to do this is running WWW::Curl v3.12, and cannot upgrade to the latest version due to C incompatibilities.