我想改變這個請求到一個HTTP PUT請求,任何想法如何?如何使用LWP創建HTTP PUT請求?
my $request = LWP::UserAgent->new;
my $response =
$request->get($url, "apikey", $apiKey, "requestDate", $requestDate);
我想改變這個請求到一個HTTP PUT請求,任何想法如何?如何使用LWP創建HTTP PUT請求?
my $request = LWP::UserAgent->new;
my $response =
$request->get($url, "apikey", $apiKey, "requestDate", $requestDate);
您應該使用HTTP ::請求:
use LWP::UserAgent;
use HTTP::Request;
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new("PUT", $url);
my $res = $ua->request($req);
PUT是HTTP ::支持::常見。您可以先構建請求並將其傳遞給用戶代理。
use HTTP::Request::Common;
use LWP;
$agent = LWP::UserAgent->new;
$request = HTTP::Request::Common::PUT($url, "apikey", $apiKey, "requestDate", $requestDate);
$response = $agent->request($request);
截至6.04,LWP::UserAgent
有put
幫手,所以你現在可以做的:
$ua->put($url)
THX我已經想通了! – Steve