HTTP::Request 用 add-content 添加 POST参数

sub MAIN($cmd) {
use HTTP::UserAgent;
my $r = HTTP::Request.new();
$r.uri: 'http://localhost/a.php';
$r.set-method: 'POST';
my $ua = HTTP::UserAgent.new;
$r.add-content("cmd=$cmd");
$r.header.field(:Content-Type<application/x-www-form-urlencoded>);
my $html = $ua.request($r);
say $r.Str;
say $html.content;
}

 相似文章:

https://www.cnblogs.com/perl6/p/9404952.html

posted on 2018-05-24 04:53  Perl6  阅读(515)  评论(0编辑  收藏  举报

导航