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;
}
相似文章: