Power, Jim (CRTEU) wrote:
Hello There,

I have being trying to get information from a web server. I manage to connect and get validated by the server's cgi script but when I what to get to the following pages I get "Access denied! Please Login now." or We were unable to process your request at this time.

my script looks like
============= start of code ========================
use HTTP: :Request: :Common qw(POST);
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
my $req = POST 'http: // ###.###.###.###:8081/FTC30/WFT/webpage.cgi',
[parm1 => 'GTUIOP', parm2 => 'notarealpasswd'];
print $ua->request($req)->as_string;
my $content = POST 'http :// ###.###.###.###:8081/FTC30/WFT/gdgegegdgg.jhfskhfh_kshfkhfkfh',
[parm1 => 'GTUIOP', parm2 => 'notarealpasswd'];
print $ua->request($content)->as_string;
================ end of code =====================stuff hidden for security reasons====


The above does not work but when I do a simple request to the second url while I have a explorer open everything works fine. So I believe that it maybe the connection going down and I need to revalidate.

My question is How do I open a session, validate and keep it open while I get the rest of the pages I need?
The site may be setting cookies and expecting them on subsequent requests.
Check your browser's cookie stores and see if there's one there.  If so,
add:

	$ua->cookie_jar(HTTP::Cookies->new);

before the first request.  There could also be problems with the 'agent'
(some sites only like certain browsers).  You could add:

	$ua->agent('Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0');
	# or whatever browser string you use

There may also be a switch to SSL and https along the way to watch for.

--
  ,-/-  __      _  _         $Bill Luebkert   ICQ=162126130
 (_/   /  )    // //       DBE Collectibles   Mailto:dbe@;todbe.com
  / ) /--<  o // //      http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic http://www.todbe.com/

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to