use strict;
use warnings;
use HTML::TreeBuilder::XPath;
use LWP::UserAgent ;
use HTTP::Request ;
use HTML::Entities;
use HTML::Strip;
use encoding "cp1252";
open (OUT, '>:encoding(cp1252)',"/home/local/ANT/jeyakuma/Desktop/test.html");
my $URL = 'http://www.footlocker.eu/it/it/k/Customer-Service/Shipping.aspx';
my $agent = LWP::UserAgent->new(agent => "Mozilla/5.0");
my $request = HTTP::Request->new(GET=> $URL);
my $response = $agent->request($request);
# Check the outcome of the response
if ($response->is_success)
{
my $xp = HTML::TreeBuilder::XPath->new_from_content($response->decoded_content);
my $raw_html = $xp->findnodes_as_string('//div[@class="faq_text"]/p/strong/u[contains(.,\'spedizione Standard \')]');
my $hs = HTML::Strip->new();
my $clean_text = $hs->parse( $raw_html );
$hs->eof;
print OUT $clean_text;
}
elsif ($response->is_error)
{
print "Error:$URL\n";
print $response->error_as_HTML;
}