cookie based asp sessions, cookie checks, and redirects
am 30.11.2004 15:04:05 von toddrw69--EXCITEBOUNDARY_000__bc81f29d0dd206c7501bb80ae3a458fc
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
I have uses WWW::Mechanize::Shell with great sucess in the past, butcurrently I am trying to access the urlhttps://www.setsivr.odjfs.state.oh.us/welcome.aspprogramm atically via perl. When I access the page with WWW::Mechanize::Shellor LWP::UserAgent or even Lynx for that matter, the browsers land on a pagecalled cookieerror.htm:[trwww@waveright temp]$ perl -MWWW::Mechanize::Shell -e 'shell'>get https://www.setsivr.odjfs.state.oh.us/welcome.aspRetrieving https://www.setsivr.odjfs.state.oh.us/welcome.asp(200)https: //www.setsivr.odjfs.state.oh.us/cookieerror.htm >There is no client script in the document.Following is some bare bones code that sould be able to be modified easilyto get the desired results, if one knew what it was missing.If someone could show me what I am missing I would really appreciate it.use warnings;use strict;my $domain = 'https://www.setsivr.odjfs.state.oh.us/';my $file; my $req; my $res;use LWP::UserAgent;use HTTP::Cookies;my $ua = LWP::UserAgent->new;my $cj = HTTP::Cookies->new();$ua->requests_redirectable( [ ] );$file = $domain . 'welcome.asp';print("fetching: $file\n");$req = HTTP::Request->new( GET => $file );$res = $ua->request($req);$cj->extract_cookies( $res );# $res->{_headers}->header('Location') eq 'cookiecheck.asp'$file = $domain . $res->{_headers}->header('Location');print("fetching: $file\n");$req = HTTP::Request->new( GET => $file );$cj->add_cookie_header( $req );$res = $ua->request($req);$cj->extract_cookies( $res );#print("cookie headers:\n", $cj->as_string, "\n");print("response headers:\n", $res->{_headers}->as_string, "\n");TIA for all responses,Todd W.
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
--EXCITEBOUNDARY_000__bc81f29d0dd206c7501bb80ae3a458fc--