So here is what I have so far, this is my attempt to manually insert
cookie data into the request header:
use HTTP::Request;
use LWP::UserAgent;
$ua = LWP::UserAgent->new(keep_alive => 1);
$ua->agent('Mozilla/5.0');
# Initial non-ssl request to www.intervalworld.com:
#
# Grabs JSESSIONID cookie
my $response_a = $ua->get("http://www.intervalworld.com");
my $cookie = $response_a->header("set-cookie");
# $cookie now contains my JSESSIONID data
# Now for my second request that requires the above cookie
my $req = new HTTP::Request
'POST','https://secure.intervalworld.com/web/cs';
$req->content_type('application/x-www-form-urlencoded');
$req->content('a=5&loginID=XXX&loginPassword=XXX&rememberMe=y');
$req->header('set-cookie' => "$cookie");
my $res = $ua->request($req);
print $res->as_string;
# The above prints a 500 error from WebSphere, the same
# kind of error I get if cookies were disabled in browser.
First question, does the above look correct? Is that how you can insert
the cookie data into the second request?
The other thing I thought about was maybe the server only accept requests
that have an appropriate referring URL. Since you have to hit,
www.intervalworld.com first, the POST to secure.intervalworld.com would
have www.intervalworld.com as the referring URL, something my perl script
lacks. How can I spoof the referring URL? I remember seeing how to do this
online awhile back, but cant find it.
Thanks