[root@yyjk sbin]#
[root@yyjk sbin]# cat a2.pl
use LWP::UserAgent;
use HTTP::Cookies;
use HTTP::Headers;
use HTTP::Response;
use Encode;
use JSON;
use File::Temp qw/tempfile/;
use HTML::TreeBuilder::XPath;
use Encode;
use HTML::TreeBuilder;
use Data::Dumper;
use HTML::TreeBuilder::XPath;
use DBI;
use Encode;
my $ua = LWP::UserAgent->new( ssl_opts => { verify_hostname => 0 }, );;
$ua->timeout(10);
$ua->env_proxy;
my $now = time();
$ua->agent("Mozilla/8.0");
my $cookie_jar = HTTP::Cookies->new(
file => 'lwp_cookies.txt',
autosave => 1,
ignore_discard => 1
);
my $tree= HTML::TreeBuilder::XPath->new;
$tree->parse_file("test.html");
##获取url
$tree->parse_file( "fh2.html");
#获取博客分类的URL,根据a标签查找属性为href
@Links = $tree->find_by_tag_name('a');
foreach (@Links) {
@Href = $_-&