Hello everyone, I'm new to perl, just a question for you experts.
I'm trying to automate a procedure that connects to a https login page through a proxy server in my company.
Follow the code I produced:
#!/usr/bin/perl use strict; use WWW::Mechanize; use HTTP::Cookies; use HTTP::Request; print " WWW::Mechanize $WWW::Mechanize::VERSION LWP $LWP::VERSION "; my $webpage = ''; my $outfile = "out.htm"; my $url = "https://xxxxx.it"; my $username = "xxxxxx"; my $password = "xxxxxx"; my $mech = WWW::Mechanize->new(); my $cookie_jar = HTTP::Cookies->new( autosave => 1, file => "cookies.t +xt"); $mech->env_proxy(); $mech->get($url); $mech->cookie_jar($cookie_jar); $mech->form_name('Login'); $mech->field(IDToken1 => $username); $mech->field(IDToken2 => $password); $mech->click(); #$mech->submit(); my $output_page = $mech->content(); open(OUTFILE, ">$outfile"); print OUTFILE "$output_page"; close(OUTFILE); print $cookie_jar->as_string, "\n";
without the proxy this seems to be working but if i try using the proxy server it doesn't work giving me back the following exit code:
400 Bad Request
Any ideas ?
Many thanks in advance.
chew23

In reply to WWW::Mechanize trought a proxy for an https page by chew23

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.