#!/usr/bin/perl -w use HTTP::Tiny; use POSIX qw(strftime); use Time::HiRes qw(gettimeofday); use Encode; use Digest::SHA qw(hmac_sha1_base64); my $ua = HTTP::Tiny->new; $timestamp = strftime '%Y-%m-%dT%H:%M:%S', gmtime(); $ip = $ENV{'REMOTE_ADDR'}; $Nonce = int(rand(1000000)); $access_key = "ddizvEmwcLu", $from = "sfsdfdf"; $message = "asdasd"; $to = "5435345435"; my $url = "https://sms-intl.ap-southeast-1.aliyuncs.com"; my $data = { AccessKeyId => $access_key, Action => "SendMessageToGlobe", Format => "JSON", From => $from, Message => $message, RegionId => "default", SecureTransport => "true", SignatureMethod => "HMAC-SHA1", SignatureNonce => $Nonce, SignatureVersion => "1.0", SourceIp => $ip, Timestamp => $timestamp, To => $to, Version => "2018-05-01", Signature => $signature, }; print "Content-type: text/html\n\n"; my $params = $ua->www_form_urlencode( $data ); my $signature = hmac_sha1_base64($params, $access_key); my $response = $ua->get( $url . '/?' . $params ); print $response->{'content'} . "\n"; printf "params = %s\n", $params; printf "sig = %s\n",$signature;