in reply to Problem while using WWW::Mechanize module for getting html
The other contributors to this thread have suggested better ways to achieve what you need, but I thought I'd point out a couple problems with how you are using the gunzip function.
Here is a quick reminder of the relevant part of your code.The first problem is you need to get the payload data from the response object. That can be done with $responce->contentmy $responce = $mech->get( "http://hiphople.com/kboard" ); my $output = "file1.txt"; gunzip $responce => $output;
The second issue is how you are using the gunzip - if the first parameter is a standard scalar variable it assumes it is a filename. That isn't what you have. You have an in-memory buffer. To get gunzip to read that buffer you pass a scalar reference. In this case you do that by prefixing $responce with a backslash.
Putting those two part together the gunzip line becomes thisWhen I made that change your code it returned this content.gunzip \$responce->content => $output;
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko"><he +ad><meta http-equiv="Content-Type" content="text/html; charset=utf-8" + /><style type="text/css">body { width:100%; height:100%; } .wrap { p +osition:fixed; top:50%; left:50%; margin:-185px 0 0 -315px; width:630 +px; height:370px; } h1 {margin: 0 0 20px; font-size: 15pt;}</style></ +head><body><script type="text/javascript" src="/cupid.js" ></script>< +script>function toNumbers(t){var e=[];return t.replace(/(..)/g,functi +on(t){e.push(parseInt(t,16))}),e}function toHex(){for(var t=[],t=1==a +rguments.length&&arguments[0].constructor==Array?arguments[0]:argumen +ts,e="",o=0;o<t.length;o++)e+=(16>t[o]?"0":"")+t[o].toString(16);retu +rn e.toLowerCase()}function getUrlParams(){var t={};return window.loc +ation.search.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(e,o,r){t[o]=r +}),t}var a=toNumbers("e89bdf97de8b4fd9fbb5729c74357328"),b=toNumbers( +"041f9966c585822241063e5f88c891d1"),c=toNumbers("b56e9ff4cacfbf3311ee +9ae970a2a2c5"),now=new Date,time=now.getTime();time+=864e5,now.setTim +e(time),document.cookie="CUPID="+toHex(slowAES.decrypt(c,2,a,b))+"; e +xpires="+now.toUTCString()+"; path=/",oParams=getUrlParams(),nCkattem +pt=0,oParams.ckattempt&&(nCkattempt=parseInt(oParams.ckattempt)),nCka +ttempt<3&&(location.href="http://hiphople.com/kboard?ckattempt=1");</ +script><div class="wrap"><div align="center"><h1>\uc790\ub3d9\ub4f1\u +b85d\ubc29\uc9c0\ub97c \uc704\ud574 \ubcf4\uc548\uc808\ucc28\ub97c \u +ac70\uce58\uace0 \uc788\uc2b5\ub2c8\ub2e4.</h1><p>Please prove that y +ou are human.</p><form action="/___verify" method="POST"><input type= +"submit" value=" OK "></form></div></div></body></html>
|
|---|