use LWP::UserAgent;
$url = '[URL unfurl="true"]http://bahn.hafas.de/bin/db.w97/query.exe/dn';[/URL]
@form = ('protocol' => 'http:', # Form content
'from' => 'augsburg hbf',
'to' => 'muenchen hbf',
'via.1' => '',
'datesel' => 'custom',
'date' => '24.03.98',
'time' => '24:00',
'timesel' => 'depart',
'new_selection' => '',
'start.x' => '9',
'start.y' => '18');
$ua = LWP::UserAgent->new(); # Create User-Agent
$ua->proxy(['http', 'ftp'], "[URL unfurl="true"]http://yourproxy:8080");[/URL]
$request = HTTP::Request->new('POST', $url); # Create Request
$request->proxy_authorization_basic('domain/user', 'password');
# Declare form content
$request->content_type('application/x-[URL unfurl="true"]www-form-urlencoded');[/URL]
# Create query string
while(($key, $value) = splice(@form, 0, 2)) {
$value =~ s/[^\w-_]/sprintf "%%%02x", ord($&)/ge;
$querystring .= "&" if $querystring;
$querystring .= "$key=$value";
}
$request->content($querystring);
$response = $ua->request($request);
print $response->content();