4 ###APPDATE: 2009-01-06 17:32:15
6 ###APPDESC: pl-netcat a http url
8 ###APPEXAMPLE: pl-netcat www.google.com
10 use lib
$ENV{XR_PERL_MODULE_DIR
};
11 use MyPlace
::Script
::Usage qw
/help_required help_even_empty/;
12 exit 0 if(help_even_empty
($0,@ARGV));
15 $url = "http://$url" unless($url =~ /^http:/i);
21 my $cache = MyPlace
::Cache
->new("pl-netcat");
22 my @values = $cache->load($url);
27 my $ua = LWP
::UserAgent
->new;
28 my $cookie = HTTP
::Cookies
->new(file
=> "$ENV{'HOME'}/.lwp_cookies.dat", autosave
=> 1);
29 $ua->cookie_jar($cookie);
30 $ua->agent("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008092416 Firefox/3.0.3 Firefox/3.0.1");
31 my $req = HTTP
::Request
->new(GET
=> $url);
32 my $res = $ua->request($req);
33 if ($res->is_success) {
34 print $cache->save($url,$res->content);
39 print STDERR
$res->status_line, "\n";