koryw has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to send a secure HTTPS Post using LWP and Crypt::SSLeay and I'm getting a 302 Object Moved error, which I assume the site that I'm contacting doesn't know where to redirect back to. Below is my code and content errors from browser and command line.
BROWSER RESULTS
HTTP/1.1 302 (Found) Object moved Cache-Control: private Connection: c +lose Date: Tue, 09 Nov 2004 20:35:56 GMT Location: https://www.studentclearinghouse.org/secure_area/InvalidBrow +ser.asp Server: Microsoft-IIS/5.0 Content-Length: 121 Content-Type: text/html Client-Date: Tue, 09 Nov 2004 21:03:53 GMT Cli +ent-Response-Num: 1 Client-SSL-Cert-Issuer: /C=US/O=RSA Data Security, Inc./OU=Secure Serv +er Certification Authority Client-SSL-Cert-Subject:/C=US/ST=Virginia/ +L=Herndon/O=National Student Clearinghouse/OU=Web Development/OU=Term +s of use at www.verisign.com/rpa (c)01/CN=www.studentclearinghouse.or +g Client-SSL-Cipher: RC4-MD5 Client-SSL-Warning: Peer certificate not verified P3P: CP="CAO CURa ADMa DEVa OUR DELa IND PHY ONL UNI PUR COM NAV DEM S +TA" Set-Cookie: ASPSESSIONIDCQQRSRSA=OBBKBLKDKKEHIAKNMIMDCAIM; path=/ Title: Object moved Object Moved This object may be found here.1 <p>COMMAND LINE RESULTS</p> Content-type: text/html <html> <head> <title>Transcript Verification Request</title> </head> <body> <div align="center"> <h1>Error submitting to Student Clearinghouse</h1> 1<BR>HTTP/1.1 302 (Found) Object moved Cache-Control: private Connection: close Date: Tue, 09 Nov 2004 20:33:10 GMT Location: https://www.studentclearinghouse.org/secure_area/InvalidBrow +ser.asp Server: Microsoft-IIS/5.0 Content-Length: 121 Content-Type: text/html Client-Date: Tue, 09 Nov 2004 21:01:07 GMT Client-Response-Num: 1 Client-SSL-Cert-Issuer: /C=US/O=RSA Data Security, Inc./OU=Secure Serv +er Certification Authority Client-SSL-Cert-Subject: /C=US/ST=Virginia/L=Herndon/O=National Studen +t Clearinghouse/OU=Web Development/OU=Terms of use at www.verisign.co +m/rpa (c)01/CN=www.studentclearinghouse.org Client-SSL-Cipher: RC4-MD5 Client-SSL-Warning: Peer certificate not verified P3P: CP="CAO CURa ADMa DEVa OUR DELa IND PHY ONL UNI PUR COM NAV DEM S +TA" Set-Cookie: ASPSESSIONIDCQQRSRSA=CFAKBLKDLKCOBIJDHIDIEMJA; path=/ Title: Object moved <head><title>Object moved</title></head> <body><h1>Object Moved</h1>This object may be found <a HREF="">here</a +>.</body> <font color ="ORANGE"><b>1</b></font> <BR><BR></div> </body> </html>
CODE
#!/usr/bin/perl use strict; print "Content-type: text/html\n\n"; use CGI; use HTTP::Request::Common qw(POST); use HTTP::Headers; use LWP::UserAgent; my $postFlag = 0; my $destURL = "https://www.studentclearinghouse.org/secure_area/ref_st +udents.asp"; my $query = CGI->new(); my $userid = $query->param('user_id'); my $qu = $query->param('qu'); my $password = $query->param('password'); my %parms = { "user_id" => $main::user_id, "password" => $main::password, "qu" => $main::qu }; my $ua = LWP::UserAgent->new(); my $req = POST $destURL, \%parms; #my $response = HTTP::Response->new(); my $response = $ua->request($req); if (! $response->is_success) { print <<EOF; <html> <head> <title>Transcript Verification Request</title> </head> <body> <div align="center"> <h1>Error submitting to Student Clearinghouse</h1> EOF print $ua->is_protocol_supported( 'https' ). "<BR>"; print $response->as_string . "<font color =\"ORANGE\"><b>1</b></font> +<BR><BR>"; print $response->content . "<font color =\"PURPLE\"><b>4</b></font> <B +R><BR>"; print <<EOF; </div> </body> </html> EOF } else { print $response->content; } exit;
20041109 Janitored by Corion: Fixed formatting
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTTPS with Crypt::SSLeay
by saintmike (Vicar) on Nov 09, 2004 at 20:55 UTC | |
|
Re: HTTPS with Crypt::SSLeay
by chromatic (Archbishop) on Nov 10, 2004 at 04:15 UTC | |
|
Re: HTTPS with Crypt::SSLeay
by inman (Curate) on Nov 10, 2004 at 09:14 UTC |