1 2 3 4 5 6 7
my $ua = LWP::UserAgent->new( agent => $useragent ); open my $fh, '>:raw', $file or die $!; my $res = $ua->get( $url, ':content_cb' => _return_callback( $fh ), ); #close $fh;
1 2 3 4 5 6 7 8
my $ua = Mojo::UserAgent->new(); $ua->transactor->name( $useragent ); my $tx = $ua->build_tx( GET => $url ); #$tx->res->max_message_size( 0 ); #open my $fh, '>:raw', $file or die $!; #$tx->res->content->on( read => _return_callback( $fh ) ); #$ua->start( $tx ); #close $fh;
my $req_string = $res->request->as_string;
1 2 3 4 5 6 7 8 9 10 11
my $ua = LWP::UserAgent->new( agent => $useragent ); open my $fh, '>:raw', $file or die $!; my $res = $ua->get( $url, ':content_cb' => _return_callback( $fh ), ); my $str = $res->request->as_string; say $str; # GET http://hostname.com/videoplayback?... # User-Agent: Mozilla/5.0
1 2 3 4 5 6 7 8 9 10 11
my $ua = Mojo::UserAgent->new(); $ua->transactor->name( $useragent ); my $tx = $ua->build_tx( GET => $url ); my $str = $tx->req->to_string; say $str; #GET /videoplayback?... HTTP/1.1 #Content-Length: 0 #User-Agent: Mozilla/5.0 #Accept-Encoding: gzip #Host: hostname.com