我正在尝试将此请求更改为HTTP PUT请求,任何想法如何?
my $request = LWP::UserAgent->new;
my $response =
$request->get($url, "apikey", $apiKey, "requestDate", $requestDate);
答案 0 :(得分:10)
您应该使用HTTP :: Request:
use LWP::UserAgent;
use HTTP::Request;
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new("PUT", $url);
my $res = $ua->request($req);
答案 1 :(得分:3)
从6.04开始,LWP::UserAgent
有一个put
帮助器,所以您现在可以这样做:
$ua->put( $url )
答案 2 :(得分:2)
PUT是HTTP :: Request :: Common。您可以先构建请求并将其传递给用户代理。
use HTTP::Request::Common;
use LWP;
$agent = LWP::UserAgent->new;
$request = HTTP::Request::Common::PUT($url, "apikey", $apiKey, "requestDate", $requestDate);
$response = $agent->request($request);