in reply to Help with LWP GET request

The extra parameters to LWP::UserAgent::get do not add URL parameters but HTTP header values -- it's not what you want. You need to construct the URL for a GET:

my $res = $ua->get( "http://www.airport-data.com/search/intl-airports. +php?field=code&kw=$arg" );

-derby

Update: As ikegami pointed out, this is not a complete solution. You do need to guard against bad input ... hmmm ... I'm going to start putting a standard disclaimer on my posts that all solutions are not complete and are only for illustrative purposes.

Replies are listed 'Best First'.
Re^2: Help with LWP GET request
by ikegami (Patriarch) on Jun 11, 2008 at 12:52 UTC

    That's buggy for many values of $arg. Fix:

    use URI::Escape qw( uri_escape ); my $form_url = "http://www.airport-data.com/search/intl-airports.php"; my $res = $ua->get( "$form_url?field=code&kw=" . uri_escape($arg) );