cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Why am I getting this?

From: Sullivan, Shawn (Omaha) <SMSullivan_at_checkfree.com>
Date: Wed, 12 Dec 2007 14:08:47 -0500

 This is the main page to our banks. What I am trying to do is write some monitoring scripts for all the banks we handle. I will look into the cookies.
Thanks

-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Michael Hecker
Sent: Wednesday, December 12, 2007 1:01 PM
To: libcurl development
Subject: Re: Why am I getting this?

Hey Shawn,
I don't know perl and I don't know the specific requirements of you bank, but I had this problem some weeks ago when I wanted to login directly into my bank.
The problem was that I didn't send all the cookies the browser normally sends, so maybe you should check if you have to GET the main page first in order to get all the cookies.

Greets,
Michael

Sullivan, Shawn (Omaha) schrieb:
> 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