perl - Pass through 302 respond and save the html for the redirect page -
i have write code html code security website. 302 respond not sure how save html webpage. below code.
#!/usr/bin/perl -w use strict; use warnings; use lwp::useragent; use http::request; use http::request::common qw(post); use http::cookies; $url="http://www.example.com"; $ua = lwp::useragent->new(); $ua->ssl_opts( verify_hostnames => 0 ); $req =http::request::common::post("$url", content_type=>'form-data', content =>[ 'username'=>'user', 'password'=>'password', ] ); $req->header('cookie' =>q(tin=287000; lastmrh_session=439960f5; mrhsession=78c9c47291c1fcedae166121439960f5)); $resp=$ua->request($req); if ($resp->is_success) { $res2 = $ua->post($resp->base, []); print $res2->decoded_content; }
below 302 respond get
<!doctype html public "-//ietf//dtd html 2.0//en"> <html><head> <title>302 found</title> </head><body> <h1>found</h1> <p>the document has moved <a href="http://www.example.com">here</a>.</p> <hr> <address>apache/2.2.3 (centos) server @ www port 80</address> </body></html>
i want html information website www.xxx.com
can 302 respond. think stuck in redirect loop not sure how pass trough it.
Comments
Post a Comment