Results 1 to 2 of 2
  1. #1
    Join Date
    May 2004
    Posts
    5

    Thumbs up Unanswered: Sessions in perl

    How can i do to manage i kind of session in perl???
    I need to keep a login and a user password during all the web execution.

  2. #2
    Join Date
    Jun 2004
    Location
    Nowhere Near You
    Posts
    89
    If you're accessing the webpages from LWP you'll want something along these lines.
    Code:
    #!\bin\users\perl -w
    
    use HTML::TreeBuilder 3;
    use HTTP::Cookies;
    use HTTP::Request::Common;
    use LWP;
    use LWP::UserAgent;
    
    my $o_CookieJar=HTTP::Cookies->new(file=>"c:/MyCookies.ckj", autosave=>1);
    my $o_Browser=LWP::UserAgent->new();
    $o_Browser->cookie_jar($o_CookieJar);
    #...
    # Go to the login page
    my($YourLoginPageURL,$YourUserName,$YourPassword);
    my($o_Response)=$o_Browser->post("$YourLoginPageURL",[UserName=>$YourUserName,Password=>$YourPassword]);
    #...
    
    # Go get the data you want
    my($YourDataPageURL,$WhereYourDataShouldBeStored);
    $o_Browser->get("$YourDataPageURL",':content_file'=>"$WhereYourDataShouldBeStored");
    $...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •