curl-library
Why am I getting this?
Date: Wed, 12 Dec 2007 13:24:13 -0500
I am getting Error 500 - Internal Server Error when I run my script here. Why is that? Also I can't use strict... Anybody know why I am not getting through. Am I missing something.
My code is:
#!/usr/bin/perl
#
# Test script for Perl extension Curl::easy. # Check out the file README for more info.
#use strict;
use WWW::Curl::Easy;
my $url = "https://secure02.bankhost.com/newgui_framed/cgi-bin/cgi_chip";
#my $url = "https://secure02.bankhost.com/newgui_framed/";
#my $url = "10.150.8.21:3002/newgui_framed/cgi-bin/cgi_chip";
my $postfields = "DE_LS_IP_ATTM_USER_NAME=testcsr&DE_LS_IP_ATM_USER_PASSW=password1&DE_WEB_COMMAND=Login";
print "Testing curl version ",WWW::Curl::Easy::version(),"\n";
# Init the curl session
my $curl= WWW::Curl::Easy->new() or die "curl init failed!\n";
# Follow location headers
$curl->setopt(CURLOPT_FOLLOWLOCATION, 1);
# Add some additional headers to the http-request:
my @myheaders=(
"I-am-a-silly-programmer: yes indeed you are",
"User-Agent: Perl interface for libcURL"
);
$curl->setopt(CURLOPT_HTTPHEADER, \@myheaders);
$curl->setopt(CURLOPT_URL, $url);
$curl->setopt(CURL_POST, 1);
$curl->setopt(CURLOPT_SSL_VERIFYPEER, 0);
$curl->setopt(CURL_POSTFIELDS, $postfields);
# 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
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";
};
# print the array out, joined up with no spaces
print join("",@body);
Received on 2007-12-12