#!/usr/bin/perl -w use LWP; use URI; use Net::SSL; my $ua = LWP::UserAgent->new( ssl_opts => { verify_hostname => 0 }, ); $ua->agent("MyApp/0.1"); my $url = "https://dysmsapi.aliyuncs.com"; my $params = [ RegionId => '1', PhoneNumbers => '4324234', SignName => 'fghgfhg', TemplateCode => 'fghgfh']; my $uri = URI->new(); $uri->query_form(@$params); $urlparam = $uri->as_string; my $req = HTTP::Request->new(POST=>$url); $req->header('Content-Type' => 'application/json; charset=UTF-8'); $req->header('access_key_id' => 'sdsadasd'); $req->header('access_key_secret' => 'asdasdsa'); $req->header('api_version' => '2017-05-25'); $req->content($urlparam); print "Content-type: text/html\n\n"; my $res = $ua->request($req); if ($res->is_success) { print $res->content; } else { #print whole resluts from post print $res->content; print "\n"; #print error code print $res->status_line; }