curl-library
Why is my header showing when I run the script.
Date: Fri, 14 Dec 2007 14:55:22 -0500
I have the following in my perl script:
if ( $ref->{'BBL'} =~ /^$option$/) {
my $url = $ref->{'URL'}.$ref->{'ACTION'};
###################################
#PUT IF for Forte to change option is this if statement.
###################################
my $postfields = "DE_LS_IP_ATTM_USER_NAME=".$ref->{'USER_NM'}."&DE_LS_IP_ATM_USER_PASSW=".$ref->{'USER_PSSW'}."&DE_WEB_PAGE_ID=".$ref->{'WEB_PAGE'}."&DE_USER_VALUE=".$ref->{'USER_VALUE'}."&DE_WEB_COMMAND=".$ref->{'WEB_COMMAND'};
print "########################33333################\n";
# print "-THE URL: $url -----------------------\n";
# Init the curl session
my $curl= WWW::Curl::Easy->new() or die "curl init failed!\n";
# Follow location headers
$curl->setopt(CURLOPT_VERBOSE, 0);
$curl->setopt(CURLOPT_NOSIGNAL, 1);
$curl->setopt(CURLOPT_FOLLOWLOCATION, 1);
$curl->setopt(CURLOPT_RETURNTRANSFER, 1);
$curl->setopt(CURLOPT_URL, $url);
$curl->setopt(CURLOPT_POST, 1);
$curl->setopt(CURLOPT_SSL_VERIFYPEER, 0);
$curl->setopt(CURLOPT_POSTFIELDS, $postfields);
$curl->setopt(CURLOPT_HEADER, 1);
# a subroutine which is called for each 'chunk' as the
# file is received.
sub body_callback {
my ($chunk,$context)=@_;
# add the chunk we received to the end of the array we've been given
print ################\n";
push @{$context}, $chunk;
return length($chunk);
# OK
}
#
# configure which subroutine to call when some data comes in
$curl->setopt(CURLOPT_WRITEFUNCTION, \&body_callback);
#
my @body;
# tell the subroutine which array to put the data into
$curl->setopt(CURLOPT_FILE, \@body);
if ($curl->perform() != 0) {
print "Failed ::".$curl->errbuf."\n";
};
my $match = "200 OK";
# print the array out, joined up with no spaces
if ( grep( /$match/,@body ) ) {
print "Matched\n";
} else {
print "No match\n";
}
Am I missing an option to hide the header when I run my script it give me the header. I think it has something to do with the body_callback but I don't see what.
Sullivan
Software Engineerr
CheckFree - now part of Fiserv
Phone: 402.951.1556
Mobile: 402.218.9814
Fax: 402.951.1597
http://www.checkfree.com<http://www.checkfree.com/>
Received on 2007-12-14