Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

LWP HTTP response is unreadable

by Chewy2426 (Initiate)
on Oct 06, 2010 at 23:29 UTC ( #863886=perlquestion: print w/replies, xml ) Need Help??
Chewy2426 has asked for the wisdom of the Perl Monks concerning the following question:

I recorded my session using livehttpheaders in Firefox. I'm trying to automate this report using LWP.

When I go to authenticate, I get this unreadable text as a response:

HTTP/1.1 200 OK Connection: close Date: Wed, 06 Oct 2010 22:22:12 GMT Server: Apache/2.2.3 (CentOS) Vary: Accept-Encoding Content-Length: 84 Content-Type: text/html; charset=ISO-8859-1 Client-Date: Wed, 06 Oct 2010 22:19:52 GMT Client-Peer: Client-Response-Num: 1 X-Powered-By: PHP/5.2.4
☻ [#←│╔(╔═▒│I╩O┤│╔0▓♂,M-H,J╠M-I-Rp-*╩/*J┘y%d(♦▬↨g┘↨┘C

Basically a bunch of random characters that aren't part of that character set. I don't think they'll show up properly.

Can anyone give me any insight? It returns a HTTP 200 response and content-type: text/html, so I don't get why it's returning this odd output.

Here's the relevant code with the username and password removed:

my $t = time(); my $resp = $ua->get(" +enticate.php?Verb=GET&Domain=foreclosureradar&Password=mypass&Version +=2.2&Login=mylogin&t=$t"); print $resp->as_string . "\n";

I'm very stuck and any help would be much appreciated. Thanks!!

Replies are listed 'Best First'.
Re: LWP HTTP response is unreadable
by Corion (Pope) on Oct 07, 2010 at 07:39 UTC

    If the URL works from within the browser, my guess is that the response is gzip-encoded. Try looking at $resp->decoded_content, the Transfer-Encoding header, or look at what WWW::Mechanize does to get at the plain data from gzipped responses.

      normally gzipped responses have headers that indicate that
Re: LWP HTTP response is unreadable
by kcott (Chancellor) on Oct 07, 2010 at 02:15 UTC

    You're accessing an https URL. The data you're getting back looks like it's encrypted.

    Try the LWP Cookbook. It has an HTTPS section.

      The response has nothing to do with HTTPS
Re: LWP HTTP response is unreadable
by Anonymous Monk on Oct 07, 2010 at 06:35 UTC
    so I don't get why it's returning this odd output.

    Broken server is broken

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://863886]
Approved by ikegami
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2018-01-24 06:59 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (256 votes). Check out past polls.