Fastest way to retrieve content
am 04.01.2005 12:17:57 von JohannHi. I'm an LWP newbie. I need to know the fastest way to do the following:
1. Retrieve dynamically generated content from a page.
2. Parse only the text info.
3. Send the parsed info to another URL.
The following is my test code for items 1 & 2. I need to know the most
efficient way to do it because I'm expecting a lot of transactions.
my $url = URI->new('http://url.somewhere.org/cgiscript');
$url->query_form('param1' => $param1, 'param2' => $param2); #there could
be as many as 10
my $ua = LWP::UserAgent->new();
$ua->timeout(60); #for future enhancement
my $response = $ua->get($url);
if ($response->is_success)
{
$content = $response->content();
$content =~ s/<[^>]*>//gs; #expecting only very simple text
so this is ok vs HTML::Parse
########## further parsing to be done after
}
For the curious, this is for a middleware I'm making - the parsed
content is to be sent to different (3rd party) URLs with different
interface requirements.
Thanks!
Johann