Great stuff I just got it going.

My problem was that I wasn't sending the correct content-type on the  
second request as I was on the first request.

On Sunday, September 1, 2002, at 02:13 PM, Robert Nicholson wrote:

> I just did google search and found one guy in here has been trying  
> this recently as well. Funny coincidence.
>
> Anyway, i'm trying to emulate logging into a web site and sending  
> myself an SMS message by posting to a form. This is all done via HTTPS  
> protocol.
>
> So far I'm getting the WLS 5.1 cookie send back correctly and I'm  
> using cookie_jar to send it back for any future requests but when I  
> submit my POST DATA to the form the response I get from their server  
> is a 500 response. Internal Server Error.
>
> Can anybody see what I'm doing wrong here?
>
> #! /usr/bin/perl -w
>
> use lib "$ENV{HOME}/lib/perl5/site_perl";
> use Date::Parse;
> use Time::Zone;
> use Mail::Address;
> use LWP::UserAgent;
> use HTTP::Request;
> use URI::Escape;
> use HTTP::Cookies;
>
> use POSIX qw(strftime);
>
> &pageSubject2();
>
> sub pageSubject2 {
>
>         $ua = LWP::UserAgent->new;
>         $cookie_jar = HTTP::Cookies->new;
>         $ua->cookie_jar($cookie_jar);
>         $request = HTTP::Request->new(POST =>
> 'https://sonic2.tac.co.th/bp3/bin/Login');
>         #$escSender = &uri_escape($sender);
>         $args = "inputUserName=USERNAME" .
>                 "&inputPassword=PASSWORD";
>
>         $request->content_type('application/x-www-form-urlencoded');
>         $request->content($args);
>         $res = $ua->request ($request);
>         print $cookie_jar->as_string;
>
>         $request = HTTP::Request->new(POST =>
> 'https://sonic2.tac.co.th/bp3/bin/Dspc/WebMessage');
>         $args = "inputEng=testing" .
>                 "&inputMix=" .
>                 "&inputMul=" .
>                 "&inputOK=Send" .
>                 "&inputSubrNumb1=PHONENUMBER" .
>                 "&inputSubrNumb2=" .
>                 "&inputSubrNumb3=" .
>                 "&inputSubrNumb4=" .
>                 "&phoneNo71=PHONENUMBER" .
>                 "&phoneNo72=" .
>                 "&phoneNo73=" .
>                 "&phoneNo74=" .
>                 "&phoneNo75=" .
>                 "&radiobutton=radiobutton";
>
>         $request->content($args);
>         $res = $ua->request ($request);
>
>         print $res->as_string;
>         return $res->is_success;
>
> }
> Here's the output of my code.
>
> Set-Cookie3:  
> WLSESERVICE="PXG66IPFfwTDfxrTMpPsXqEPALQJPmU6L2ck0UzFH88F2tfq8KJP|12704 
> 33455858244886/169083237/6/7001/7001/7002/7002/7001/-1"; path="/";  
> domain="sonic2.tac.co.th"; path_spec; discard; version=0
> HTTP/1.1 500 (Internal Server Error) Server Error
> Cache-Control: no-cache
> Connection: close
> Date: Sun, 01 Sep 2002 07:00:53 GMT
> Pragma: No-Cache
> Server: Netscape-Enterprise/4.0
> Content-Length: 981
> Content-Length: 981
> Content-Type: text/html
> Expires: Thu, 01 Jan 1970 00:00:00 GMT
> Client-Date: Sun, 01 Sep 2002 07:00:53 GMT
> Client-Response-Num: 1
> Client-SSL-Cert-Issuer: /C=ZA/ST=Western Cape/L=Cape Town/O=Thawte  
> Consulting cc/OU=Certification Services Division/CN=Thawte Server  
> [EMAIL PROTECTED]
> Client-SSL-Cert-Subject: /C=TH/ST=Bangkok/L=Bangkok/O=Total Access  
> Communication PCL./OU=Corporate Information System/CN=sonic2.tac.co.th
> Client-SSL-Cipher: EXP1024-RC4-SHA
> Client-SSL-Warning: Peer certificate not verified
> Title: Error 500--Internal Server Error
> X-Meta-GENERATOR: WebLogic htmlKona 5.1.0 Service Pack 9 04/05/2001  
> 14:59:53 #105983
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Draft//EN">
> <HTML>
> <HEAD>
> <TITLE>Error 500--Internal Server Error</TITLE>
> <META NAME="GENERATOR" CONTENT="WebLogic htmlKona 5.1.0 Service Pack 9  
> 04/05/2001 14:59:53 #105983">
> </HEAD>
> <BODY vlink="#DE7E00" link="#640078" alink="#397F70" bgcolor="white">
> <FONT FACE=Helvetica><BR CLEAR=all>
> <TABLE border=0 cellspacing=5><TR><TD><BR CLEAR=all>
> <FONT FACE="Helvetica" COLOR="black" SIZE="3"><H2>Error 500--Internal  
> Server Error</H2>
> </FONT></TD></TR>
> </TABLE>
> <TABLE width=100% border=0 cellpadding=10><TR><TD VALIGN=top  
> WIDTH=100% BGCOLOR=white><FONT FACE="Courier New"><FONT  
> FACE="Helvetica" SIZE="3"><H3>From RFC 2068 <i>Hypertext Transfer  
> Protocol -- HTTP/1.1</i>:</H3>
> </FONT><FONT FACE="Helvetica" SIZE="3"><H4>10.5.1 500 Internal Server  
> Error</H4>
> </FONT><P><FONT FACE="Courier New">The server encountered an  
> unexpected condition which prevented it from fulfilling the  
> request.</FONT></P>
> </FONT></TD></TR>
> </TABLE>
>
> </BODY>
> </HTML>

Reply via email to