@neverminda - Obviously I'm going to do more than just log on to my blogger account.

@naikonta - I was thinking about using the API, and I might have to if I don't solve this problem. Thanks for your input.

@moritz - That url string is taken from an iframe. If you just use $mech->get('http://www.blogger.com/'); you will find that google has hidden the login form in an iframe. I just took the url from that login and put it into a scalar variable.

The redirect is a javascript redirect. This is what it looks like (and where I've gotten stuck).
<html> <head> <script language="JavaScript" type="text/javascript"> <!-- function doRedirect(url) { open(url, "_top"); } --> </script> <script language="JavaScript1.4" type="text/javascript"> <!-- function doRedirect(url) { try { open(url, "_top"); } catch (xcp) { insertContinueLink(); } } --> </script> <script language="EcmaScript" type="text/javascript"> <!-- function doRedirect(url) { try { open(url, "_top"); } catch (xcp) { insertContinueLink(); } } --> </script> <script type="text/javascript"> <!-- var firsttime = "firsttime"; var goback = "goback"; var gofwd = "gofwd"; function redirect() { var url = 'https:\x2F\x2Fwww.google.com\x2Faccounts\x2FCheckCook +ie?service=blogger&chtml=LoginDoneHtml'; var state = document.dummyform.dummyfield.value; var lastUrl = document.dummyform.dummyfield2.value; if ((state == firsttime) || (url != lastUrl)) { // First time visit or passive login document.dummyform.dummyfield.value = goback; document.dummyform.dummyfield.defaultvalue = goback; document.dummyform.dummyfield2.value = url; document.dummyform.dummyfield2.defaultvalue = url; doRedirect(url); } else if (state == goback) { // Remember that we should go forward next time and go backwar +d. document.dummyform.dummyfield.value = gofwd; document.dummyform.dummyfield.defaultvalue = gofwd; history.back(); } else if (state == gofwd) { // Remember that we should go backward next time and go forwar +d. document.dummyform.dummyfield.value = goback; document.dummyform.dummyfield.defaultvalue = goback; history.forward(); } } // Tells the user we are waiting for the page to redirect function insertLoadingMessage() { document.getElementById("loadingDiv").style.visibility = "visibl +e"; } function insertContinueLink() { document.getElementById("loadingDiv").style.visibility = "hidden +"; document.getElementById("clickToContinue").style.visibility = "v +isible"; } --> </script> <style type="text/css"><!-- body { color:white; background:#F5EDE3; font-size: 12; font-family:"Trebuchet MS"; } #loadingDiv { float:left; background:#826C55; margin:10px 0 0 10px; } a { color: white; } --></style> <script type="text/javascript"><!-- if (document.referrer.indexOf('nui=8') >= 0) { document.write('<style type="text/css">'); document.write('#body { background: #036 }'); document.write('#body #loadingDiv { background: none }'); document.write('</style>'); } // --> </script> </head> <body onload="insertLoadingMessage();redirect();" id="body" dir="ltr" onpageshow="if (event.persisted) redirect();"> <div id="loadingDiv" style="visibility:hidden;"> Loading... </div> <div style="visibility:hidden;" id="clickToContinue"> <a target="_top" href="https://www.google.com/accounts/CheckCookie?s +ervice=blogger&chtml=LoginDoneHtml">Click here to continue</a> </div> <form name="dummyform" action="" > <input name="dummyfield" value="firsttime" style="visibility:hidden" + /> <input name="dummyfield2" value="" style="visibility:hidden" /> </form> <noscript> Please <a href="https://www.google.com/accounts/CheckCookie?service=blogger +&chtml=LoginDoneHtml" target="_top">click here to continue</a>. </noscript> </body> </html>

I've tried to do a $mech->follow_link( text => 'click here to continue'); but that just takes you in a circle.

I also tried using a regular expression to take out "https:\x2F\x2Fwww.google.com\x2Faccounts\x2FCheckCook +ie?service=blogger&chtml=LoginDoneHtml" (the redirect url), but I get a "500 Can't connect to :443 (Bad hostname '')" error.

In reply to Re: WWW::Mechanize login problems by lv211
in thread WWW::Mechanize login problems by lv211

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, details, 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, summary, 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.