Zentara wrote: > On Fri, 4 Oct 2002 06:19:55 +0200, [EMAIL PROTECTED] (Octavian Rasnita) > wrote: > >>Hi all, >> >>I've tried a sinple test script for testing the LWP module and I've >>received the following result: >>501Protocol scheme 'http' is not supported > Here are a couple of examples. You don't need useragent just to > get a simple page. UserAgent is usually used to post form data to > a cgi. > ###################################################### > #!/usr/bin/perl > use warnings; > > #to get a page > use LWP::Simple; > $data = get("http://192.168.0.1"); > print "$data\n"; > > #or for getting cgi > use LWP::UserAgent; > $cnt="http://192.168.0.1/cgi-bin/showenv"; > $agent=new LWP::UserAgent; > $rqs=new HTTP::Request('GET',$cnt); > $data=$agent->request($rqs); > print $data->content."\n";
The former will fetch any web server output via the get method: [trwww@devel_rh trwww]$ perl -MLWP::Simple -e 'print get("http://localhost/~trwww/index.cgi?name=todd");' output: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"> <head> <title>Untitled Document</title> </head> <body> <h1>Hello Dynamic CGI Linux</h1> <div>Hello Dynamic CGI Linux!!!</div> <div>I am: trwww</div> </body> </html> Todd W. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]