# # # This is the page I need to access after the login # $agent->get("http://hostnamename.us.company.com/pls/page\$.startup"); print "$agent->{content}"; # but this just sends me back to the login page

Logon Required

Please enter your username and password to log on

I've tried using the $agent->back(); to return to the previous page but the seems to result in my logged in ness disappearing as well. I've also tried creating $agent2 to just do the login but it doesn't let $agent stay logged in. Any suggestions? I'm running on WinNT but can switch to W2K or Solaris or Linux if it helps or makes any difference to anything. Thanks Graham [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => <3EFAC3D1.46CDA25C@oracle.com> [ref] => [htmlstate] => on_nl2br [postusername] => Graham Wood [ip] => Graham.T.Wood@o [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) -->Forking child process with WWW::Automate - PERL Miscellaneous

Forking child process with WWW::Automate - PERL Miscellaneous

Hi all, I'm attempting to automate a login to a web server with WWW::Automate and then to continue navigating through the website. I've hit a problem where I'm able to log in to the web site but then I don't get automatically returned to the page I logged in from and all attempts to get there have just resulted in a repeat request to log in. Can anyone tell me how I could fork a child agent to handle the login and then continue in the parent process safe in the knowledge that I am logged in? Here's what I'm ...

  1. #1

    Default Forking child process with WWW::Automate

    Hi all,

    I'm attempting to automate a login to a web server with WWW::Automate
    and then to continue navigating through the website. I've hit a problem
    where I'm able to log in to the web site but then I don't get
    automatically returned to the page I logged in from and all attempts to
    get there have just resulted in a repeat request to log in.

    Can anyone tell me how I could fork a child agent to handle the login
    and then continue in the parent process safe in the knowledge that I am
    logged in?

    Here's what I'm doing now:

    use WWW::Automate;
    my $agent = WWW::Automate->new();
    $agent->get("http://hostnamename.us.company.com/pls/show_logon_form");
    $agent->field("p_username","jbloggs");
    $agent->field("p_password","jbpass");
    $agent->submit();
    print "$agent->{content}";

    #
    # this shows..
    #<H2>Logon Successful</H2>
    #<H4>Please navigate back to the application</H4>
    #<SCRIPT><!--opener.location.reload(true);
    #opener.location = opener.location;
    #//--></SCRIPT>
    #<SCRIPT>
    #<!--
    #self.close();
    #//--></SCRIPT>

    #
    # This is the page I need to access after the login
    #
    $agent->get("http://hostnamename.us.company.com/pls/page\$.startup");
    print "$agent->{content}";

    # but this just sends me back to the login page
    <H2>Logon Required</H2>
    <H4>Please enter your username and password to log on</H4>
    <FORM ACTION="page.process_logon" METHOD="POST" NAME="Logonform">
    <TABLE >
    <TR>
    <TD>Username: </TD>
    <TD><INPUT TYPE="text" NAME="p_username"></TD>
    </TR>
    <TR>
    <TD>Password: </TD>
    <TD><INPUT TYPE="password" NAME="p_password"></TD>
    </TR>
    <TR>
    <TD><INPUT TYPE="submit" VALUE="Log on"></TD>

    I've tried using the $agent->back(); to return to the previous page but
    the seems to result in my logged in ness disappearing as well.

    I've also tried creating $agent2 to just do the login but it doesn't let
    $agent stay logged in.

    Any suggestions? I'm running on WinNT but can switch to W2K or Solaris
    or Linux if it helps or makes any difference to anything.

    Thanks

    Graham

    Graham Wood Guest

  2. #2

    Default Re: Forking child process with WWW::Automate

    I solved my problem with LWP::UserAgent and HTTP::Cookies. When I set up a
    cookie_jar the login information became persistent.

    See perldoc lwpcook for details of how to do it if you're suffering from the
    same problem.

    Graham

    Graham Wood Guest

  3. #3

    Default Re: Forking child process with WWW::Automate

    Graham Wood wrote:
    >I'm attempting to automate a login to a web server with WWW::Automate
    >and then to continue navigating through the website.
    Currently the favourite module to do this kind of thing is
    WWW::Mechanize, which is "inspired" by WWW::Automate. In addition,
    there's WWW::Mechanize::Shell, which lets you explore the website using
    WWW::Mechanize using an interactive prompt interface.

    It has built-in support for cookies.

    --
    Bart.
    Bart Lateur Guest

  4. #4

    Default Re: Forking child process with WWW::Automate

    Bart Lateur wrote:
    > Graham Wood wrote:
    >
    > >I'm attempting to automate a login to a web server with WWW::Automate
    > >and then to continue navigating through the website.
    >
    > Currently the favourite module to do this kind of thing is
    > WWW::Mechanize, which is "inspired" by WWW::Automate. In addition,
    > there's WWW::Mechanize::Shell, which lets you explore the website using
    > WWW::Mechanize using an interactive prompt interface.
    >
    > It has built-in support for cookies.
    >
    > --
    > Bart.
    Thanks Bart, I've got the WWW::Mechanize stuff now.

    Graham

    Graham Wood Guest

Similar Threads

  1. HELP! Need to write batch file to automate securityupdate process
    By dkeeling0419 in forum Coldfusion Server Administration
    Replies: 0
    Last Post: March 1st, 03:25 PM
  2. Replies: 0
    Last Post: October 18th, 09:18 PM
  3. How to get the child process pid ?
    By pthomsin in forum Linux / Unix Administration
    Replies: 3
    Last Post: December 1st, 06:40 AM
  4. forking and ending a CGI process
    By Rob Young in forum PERL Miscellaneous
    Replies: 1
    Last Post: August 11th, 10:04 PM
  5. How to impersonate the child process of a web service
    By Aadil Abbas in forum ASP.NET Web Services
    Replies: 6
    Last Post: August 4th, 07:19 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
Username:
Password: