如何在perl中发出包含application/x-www-form-urlencoded数据的HTTP PUT请求?
如何在Perl中发出包含如何在perl中发出包含application/x-www-form-urlencoded数据的HTTP PUT请求?,perl,http,rest,Perl,Http,Rest,如何在Perl中发出包含application/x-www-form-urlencoded数据的HTTP PUT请求 这是一个等效的POST请求: my $ua = new LWP::UserAgent; my $response = $ua->post( $url, { "parameter1" => $value1, "parameter2" => $value2 } ); 作为PUT请求,将如何执行此操
application/x-www-form-urlencoded
数据的HTTP PUT请求
这是一个等效的POST请求:
my $ua = new LWP::UserAgent;
my $response = $ua->post(
$url,
{
"parameter1" => $value1,
"parameter2" => $value2
}
);
作为PUT请求,将如何执行此操作?
LWP中没有put
方法,并且不采用表单数据
有关是否允许包含表单数据的PUT请求的讨论,请参阅
这是PUT请求的一个示例,但它不包含用于封装表单数据的代码:只需发出
POST
-请求并将其方法更改为PUT
:
use HTTP::Request::Common;
my $req = POST('http://example.com/', Content => [param => 'value']);
$req->method('PUT');
say($req->as_string);