i need some help, am trying to code Alibaba cloud sms

#!/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; }

am getting this error: FC41FAB2-2735-4495-A072-54850CD00A4Edysmsapi.aliyuncs.comInvalidVersionSpecified parameter Version is not valid. 400 Bad Request

am trying to make it like these example codes in php, python and ruby. because aliabab cloud sms doesn't have it in perl

PYTHON #!/usr/bin/env python #coding=utf-8 from aliyunsdkcore.client import AcsClient from aliyunsdkcore.request import CommonRequest client = AcsClient('<accessKeyId>', '<accessSecret>', 'default') request = CommonRequest() request.set_accept_format('json') request.set_domain('dysmsapi.aliyuncs.com') request.set_method('POST') request.set_protocol_type('https') # https | http request.set_version('2017-05-25') request.set_action_name('SendSms') request.add_query_param('RegionId', "default") request.add_query_param('PhoneNumbers', "7766") request.add_query_param('SignName', "iiuy") request.add_query_param('TemplateCode', "jkk") response = client.do_action(request) # python2: print(response) print(str(response, encoding = 'utf-8')) RUBY # gem install aliyunsdkcore require 'aliyunsdkcore' client = RPCClient.new( access_key_id: '<accessKeyId>', access_key_secret: '<accessSecret>', endpoint: 'https://dysmsapi.aliyuncs.com', api_version: '2017-05-25' ) response = client.request( action: 'SendSms', params: { "RegionId": "default", "PhoneNumbers": "7766", "SignName": "iiuy", "TemplateCode": "jkk" }, opts: { method: 'POST' } ) print response PHP <?php use AlibabaCloud\Client\AlibabaCloud; use AlibabaCloud\Client\Exception\ClientException; use AlibabaCloud\Client\Exception\ServerException; // Download&#65306;https://github.com/aliyun/openapi-sdk-php // Usage&#65306;https://github.com/aliyun/openapi-sdk-php/blob/master/ +README.md AlibabaCloud::accessKeyClient('<accessKeyId>', '<accessSecret>') ->regionId('cn-hangzhou') // replace regionId +as you need ->asDefaultClient(); try { $result = AlibabaCloud::rpc() ->product('Dysmsapi') // ->scheme('https') // https | http ->version('2017-05-25') ->action('SendSms') ->method('POST') ->host('dysmsapi.aliyuncs.com') ->options([ 'query' => [ 'RegionId' => "default", 'PhoneNumbers' => "7766", 'SignName' => "iiuy", 'TemplateCode' => "jkk", ], ]) ->request(); print_r($result->toArray()); } catch (ClientException $e) { echo $e->getErrorMessage() . PHP_EOL; } catch (ServerException $e) { echo $e->getErrorMessage() . PHP_EOL; }

In reply to alibaba cloud sms api by bigup401

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.