Anyone familiar with the Chilkat ActiveX HTTP component or Pearl LWP? Im trying to reproduce some code that we currently have working in Pearl. What am trying to do is to log into an internet appliance and read the log file.
The login requires cookies. In a regular web browser I can just use http://test.com:3800/login.tgi?Username=BOB&Password=12345. Then once the login cookie is stored in the browser I can navigate to the log file page.
The working Pearl code is
my $Authenticate = "http://test.com:3800/login.tgi?Username=BOB&Password=12345";
my $Action = "http://test.com:3800/log”;
use strict qw/refs/;
use HTTP::Cookies;
use LWP::UserAgent;
use HTTP::Request::Common qw/POST GET/;
my $Browser = LWP::UserAgent->new(
cookie_jar => HTTP::Cookies->new,
requests_redirectable => [],
timeout => 10,
pragma => "no-cache",
max-age => 0,
agent => "Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko/20100101 Firefox/11.0"
);
my $Page = $Browser->request(GET $Authenticate);
if ($Page->is_success) { my $Page = $Browser->request(GET $Action); }
else { print $ErrorPage; die; }
I put this together quickly in VB using the ActiveX component but I doesn't even successfully login.
Authenticate = "http://test.com:3800/login.tgi?Username=BOB&Password=12345"
Action = "http://test.com:3800/log”
Set HTTP = New ChilkatHttp
HTTP.UserAgent = "Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko/20100101 Firefox/11.0"
HTTP.HeartbeatMs = 500
HTTP.ConnectTimeout = 45
HTTP.ReadTimeout = 100
HTTP.FetchFromCache = False
HTTP.FreshnessAlgorithm = 0
HTTP.DefaultFreshPeriod = 1
HTTP.MaxFreshPeriod = 1
HTTP.MaxFreshPeriod = 1
HTTP.SaveCookies = 1
HTTP.SendCookies = 1
HTTP.CookieDir = "memory"
Auth = HTTP.QuickGetStr (Authenticate)
If Auth <> "" Then Act = HTTP.QuickGetStr(Action)
Auth is returning
<HTML><HEAD>
<META HTTP-EQUIV="refresh" content="0; URL=/index.htm">
</HEAD><BODY></BODY>
</HTML>
If I substitute another URL for the login url, or leave off the login credentials (so it is just) http://test.com:3800 Auth gives me the correct HTML for that web page.
Can anyone see anything that is different between the 2 code snippets, or think of a reason that I may be having this issue?