Re: Using the module HTTP::Request

2005-10-01 Thread Josh Brown



Hello All,

	I am trying to use the module HTTP::Request. I tried to use the code given in 
perldoc HTTP::Request


Here is my code
==

#!/usr/bin/perl -w

use strict;
require HTTP::Request;
require LWP::UserAgent;
my ($request,$response,$ua);

$ua = LWP::UserAgent-new;
$request = HTTP::Request-new('GET' = http://www.google.com/;);
$response = $ua-request($request);
print $response\n;


But the output of the code is

perl aprequest.pl
HTTP::Response=HASH(0x81e8a84)

How can I make this human readable.

Thanks in Advance.

Kind Regards,
Ranish

 


Perldoc LWP::UserAgent ... even a beginner knows that.

require LWP::UserAgent;

my $ua = LWP::UserAgent-new;
$ua-timeout(10);
$ua-env_proxy;

my $response = $ua-get(’http://search.cpan.org/’);

if ($response-is_success) {
*print $response-content;* # or whatever
}
else {
die $response-status_line;
}


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Using the module HTTP::Request

2005-09-30 Thread Ranish
Hello All,

I am trying to use the module HTTP::Request. I tried to use the code 
given in 
perldoc HTTP::Request

Here is my code
==

#!/usr/bin/perl -w

use strict;
require HTTP::Request;
require LWP::UserAgent;
my ($request,$response,$ua);

$ua = LWP::UserAgent-new;
$request = HTTP::Request-new('GET' = http://www.google.com/;);
$response = $ua-request($request);
print $response\n;


But the output of the code is

perl aprequest.pl
HTTP::Response=HASH(0x81e8a84)

 How can I make this human readable.

Thanks in Advance.

Kind Regards,
Ranish

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Using the module HTTP::Request

2005-09-30 Thread Bob Showalter

Ranish wrote:

But the output of the code is

perl aprequest.pl
HTTP::Response=HASH(0x81e8a84)

How can I make this human readable.


print $response-as_string;


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response