http://www.perlmonks.org?node_id=371009


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

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?

In short, no. Putting "TONs of time" into automating a web site without looking at a working connection will never work, or at least require inordinate amounts of "TONs of time".

I recommend that you record a complete session with the actual browser, and that you don't fake a non-existing browser that has the UserAgent header Mozilla/5.0 - please look at the traffic sent by LWP and compare it to the traffic sent by your browser. Pretending to be a browser starts by sending the same data as the browser.

I can only recommend to you to try a different route and let the code you alreday have lie still for a while. Try the approach of imitating a browser by mimicking exactly what it does by actually striving to send the data identically to what the browser would send.

HTTP::Recorder (by leira) and WWW::Mechanize::Shell (by me) are two modules that will try to write WWW::Mechanize scripts for you, and maybe they will already suffice, but I cannot stress enough the point of comparing at what your script is sending against the working solution of what your browser is sending.