Thread Request strings
(4 answers)
Opened by Kuerbis at 2015-05-21 12:08
Kann ich annehmen, dass die beide das gleiche abholen?
Code (perl): (dl
)
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 Code (perl): (dl
)
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 |