http://qs321.pair.com?node_id=465382

cajun has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to grab the 'keywords' from the header of a web page. I found in Perl & LWP, where I thought '$response->header('keywords')' would grab this for me. But as of yet it has not worked, nor have I been able to figure out why it isn't working.

I've looked at the docs for LWP, LWP::Simple, LWP::UserAgent, lwpcook, just to name a few.

Thanks for any suggestions.

#!/usr/bin/perl -w use strict; use LWP; use LWP::UserAgent; my $browser = LWP::UserAgent->new(); $browser->env_proxy(); # if we're behind a firewall my $url = 'http://www.somewebsite.com/'; my $response = $browser->get($url); die "Error \"", $response->status_line(), "\" when getting $url" unless $response->is_success(); my $keywords = $response->header('keywords'); print $keywords;