Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I have looked at that module and I don't see how to use a cookie_jar with it to first login to their website. I am looking through the module on cpan with the doc therein contained.

I have put a TON of time into this and don't want to start at ground zero, unless I have to. Therefore, how would I get what I have already written to work?

I added all the form fields to the LWP version I made, but it does not seem to be doing it right. Is there a way to make this code here work:
use HTTP::Request; use HTTP::Cookies; my $_cookie_file = "/home/first/cook/.lwp_cookies.dat"; $_post_url = 'http://www.eb2b.net/E2B_UMLogOn.process'; # Create new LWP::UserAgent object $browser = LWP::UserAgent->new; # Add a new Cookie Jar to the LWP Object $browser->cookie_jar(HTTP::Cookies->new("file" => $_cookie_file)); # Spoof a very capable browser $browser->agent('Mozilla/5.0'); # Allow https protocol and http.... $browser->protocols_allowed( [ 'http', 'https'] ); # Add the HTTP::Request for POST... $req = HTTP::Request->new("POST" => "$_post_url"); # Add "content type" as form encoded $req->content_type("application/x-www-form-urlencoded"); # Add the "Form fields" that are contained in the page... $req->content("IWPEProcessFlow.submitted.sequenceID=&logonUsername=m +yhiddenusername&logonPassword=myhiddenpass&Logon=Login&hMsgUserNotFou +nd=User with this name was not found.&hMsgInvalidPassword=Logon not v +alid.&fromHomePage=default_B2B.htm"); # Spoof the referrer to make the site think it's a person # from the login page... $req->referrer("http://www.eb2b.net/Templates/UM/RegisterCustomer/E2 +B_UMLogon.tem"); # Ok, now Perform Task $response = $browser->request($req); if($response->is_success) { # This is not working as it is posting in the 'ELSE' statement. It is +actually posting this in the "$response->content" field: START $response->content <HTML> <!-- IWLoadCurrentCustomerLocale.tem - -- Copyright (c) 1997 InterWorld Corporation --> <HEAD> <META HTTP-EQUIV=REFRESH CONTENT="1;URL=/E2B_UMLogOn.process"> <TITLE>Refresh User Repository</TITLE> </HEAD> <BODY BGCOLOR="#ffffff"> <!--<A HREF="/E2B_UMLogOn.process"> <FONT SIZE="3" FACE="verdana, arial, helvetica">Please click here to c +ontinue...</FONT></A> --> </BODY> </HTML> END $response->content
If not I'll try to figure out how to use the WWW::Mechanize module.

Thank you for any further assistance you can be.

Richard

In reply to Re^2: Remote Login and Form Posting by powerhouse
in thread Remote Login and Form Posting by powerhouse

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (8)
    As of 2020-06-03 11:32 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Do you really want to know if there is extraterrestrial life?



      Results (23 votes). Check out past polls.

      Notices?