Net::HTTP 一次添加 cookie, body 发送post请求

时间:2022-04-10 04:30:04
use Net::HTTP::Request; use Net::HTTP::URL; use Net::HTTP::Transport; my $url     = Net::HTTP::URL.new("http://localhost/sqli-labs-master/Less-1/?id=2%"); my $request = Net::HTTP::Request.new(:$url, :method<POST>, header => {:Host<google.com>,:cookie<abcde=1>}, body => 'abcde'); say $request.WHAT; say $request.Str; say $request.^methods; my $transport = Net::HTTP::Transport.new; my $response  = $transport.round-trip($request); say $response.body.decode('utf-8');