develooper Front page | perl.libwww | Postings from June 2003

LWP::UserAgent

From:
Sun Biao
Date:
June 3, 2003 06:25
Subject:
LWP::UserAgent
Message ID:
D7387C1AA470D51199E300508BBB4155308457@f94000r4.essen.karstadt.de
Hi,
I try the first time using the LWP::UserAgent to get some data from an
another url but it failed. I got from the following pgm the prints:
status=200 EOF         
refl=SCALAR(0x2028b07c)
cont= 
cont=
I think the rc 200 is ok but what is about 200 EOF? Why not is the content
empty? Perhaps I understand LWP somehow wrong. 
The pgm:
#!/usr/local/bin/perl -w                   
my $url = 'http://k004/kt0574/cgi/test.pl';
use LWP;                                   
my $browser;                               
 $browser = LWP::UserAgent->new();         
 my $resp = $browser->get($url);           
 print "status=",$resp->status_line(),"\n";
 print "refl=",$resp->content_ref(),"\n";  
 for(${$resp->content_ref()}) {            
    print "cont=$_\n";                                          
   }                                       
print "cont=",$resp->content,"\n";

And the http://k004/kt0574/cgi/test.pl:
print("\n");                  
print <<END_of_Multiline_Text;
Content-type: text/html       
 <html>                       
 <head>                       
 <body>                       
 <h1>Hallo world k004         
END_of_Multiline_Text         
print "your name is K004";    
print <<ALL_Done;             
 </body>                      
 </html>                      
ALL_Done                      

Thanks
B. Sun
                             





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About