perldoc HTTP::Request$r = HTTP::Request->new( $method, $uri, $header, $content )
Constructs a new HTTP::Request object describing a request on the object $uri using method $method. The $method argument must be a string. The $uri argument can be either a string, or a reference to a URI object. The optional $header argument should be a reference to an HTTP::Headers object or a plain array reference of key/value pairs. The optional $content argument should be a string of bytes.
1 2 3 4 5 6 7 8 9 10 11 12
my $h = HTTP::Headers->new; $h->authorization_basic('user','passwort_im_klartext'); my $request = HTTP::Request->new( 'GET', 'http://www. ... .de/script', $h, ); my $id1 = $async->add($request); my $id2 = $async->add( HTTP::Request->new(GET => 'http://www. ... .de')); while ( my ( $response, $id ) = $async->wait_for_next_response ) { say $id.' liefert '.length($response->decoded_content)." Byte: '".$response->decoded_content."'"; }
http://user:passwort@www.domain.tld/path/page.htm