阿里云短信介绍和购买流程和使用流程

简介: 联网时代短信的应用无处不在,如APP的注册,平时的短信通知等。下面就由小编系统的讲解一下阿里云短信的购买和使用流程

互联网时代短信的应用无处不在,如APP的注册,平时的短信通知等。

下面就由小编系统的讲解一下阿里云短信的购买和使用流程

1,无论怎么样首先你需要注册个阿里云账号

  1. 点击下面链接注册:

注册阿里云

输入账户名和密码和手机号


注册完成以后,请到个人中心做实名。 切记:如果是企业行为一定是要做企业实名,不要个人实名。https://account.console.aliyun.com/v2/#/authc/types


2,购买短信套餐包

  1. 点击下面链接:https://www.aliyun.com/product/sms


点击:立即购买 一般项目刚刚上线,选择1.5万条短信就够了。


3,设置短信签名

  1. https://dysms.console.aliyun.com/domestic/text


填写:签名,签名用途,签名来源,场景说明




4,设置短信模板。


填写:模型类型,关联签名,模板名称,模板内容,场景链接,场景说明


5,接入短信SDK

首先获取到AccessKey

AccessKey ID:用于标识用户。

AccessKey Secret:用于验证用户的密钥。AccessKey Secret必须保密。

点击下面链接:

https://ram.console.aliyun.com/manage/ak?spm=5176.12818093.top-nav.dak.5adc16d0Ixl28b

创建AccessKey



以下是发送短信和批量发送短信的接口地址:

https://help.aliyun.com/document_detail/419273.html?spm=a2c4g.419274.0.0.29cb4198AtA3Qx


调试发送短信的demo

https://next.api.aliyun.com/api/Dysmsapi/2017-05-25/SendSms?spm=a2c4g.419273.0.i1&tab=DEMO&lang=JAVAASYNC


下面是Java代码实力

// This file is auto-generated, don't edit it. Thanks. package demo; import com.aliyun.auth.credentials.Credential; import com.aliyun.auth.credentials.provider.StaticCredentialProvider; import com.aliyun.core.http.HttpClient; import com.aliyun.core.http.HttpMethod; import com.aliyun.core.http.ProxyOptions; import com.aliyun.httpcomponent.httpclient.ApacheAsyncHttpClientBuilder; import com.aliyun.sdk.service.dysmsapi20170525.models.*; import com.aliyun.sdk.service.dysmsapi20170525.*; import com.google.gson.Gson; import darabonba.core.RequestConfiguration; import darabonba.core.client.ClientOverrideConfiguration; import darabonba.core.utils.CommonUtil; import darabonba.core.TeaPair; //import javax.net.ssl.KeyManager; //import javax.net.ssl.X509TrustManager; import java.net.InetSocketAddress; import java.time.Duration; import java.util.*; import java.util.concurrent.CompletableFuture; public class SendSms {     public static void main(String[] args) throws Exception {         // HttpClient Configuration         /*HttpClient httpClient = new ApacheAsyncHttpClientBuilder()                 .connectionTimeout(Duration.ofSeconds(10)) // Set the connection timeout time, the default is 10 seconds                 .responseTimeout(Duration.ofSeconds(10)) // Set the response timeout time, the default is 20 seconds                 .maxConnections(128) // Set the connection pool size                 .maxIdleTimeOut(Duration.ofSeconds(50)) // Set the connection pool timeout, the default is 30 seconds                 // Configure the proxy                 .proxy(new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("<your-proxy-hostname>", 9001))                         .setCredentials("<your-proxy-username>", "<your-proxy-password>"))                 // If it is an https connection, you need to configure the certificate, or ignore the certificate(.ignoreSSL(true))                 .x509TrustManagers(new X509TrustManager[]{})                 .keyManagers(new KeyManager[]{})                 .ignoreSSL(false)                 .build();*/         // Configure Credentials authentication information, including ak, secret, token         StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder()                 .accessKeyId("<your-accessKeyId>")                 .accessKeySecret("<your-accessKeySecret>")                 //.securityToken("<your-token>") // use STS token                 .build());         // Configure the Client         AsyncClient client = AsyncClient.builder()                 .region("cn-hangzhou") // Region ID                 //.httpClient(httpClient) // Use the configured HttpClient, otherwise use the default HttpClient (Apache HttpClient)                 .credentialsProvider(provider)                 //.serviceConfiguration(Configuration.create()) // Service-level configuration                 // Client-level configuration rewrite, can set Endpoint, Http request parameters, etc.                 .overrideConfiguration(                         ClientOverrideConfiguration.create()                                 .setEndpointOverride("dysmsapi.aliyuncs.com")                         //.setConnectTimeout(Duration.ofSeconds(30))                 )                 .build();         // Parameter settings for API request         SendSmsRequest sendSmsRequest = SendSmsRequest.builder()                 // Request-level configuration rewrite, can set Http request parameters, etc.                 // .requestConfiguration(RequestConfiguration.create().setHttpHeaders(new HttpHeaders()))                 .build();         // Asynchronously get the return value of the API request         CompletableFuture<SendSmsResponse> response = client.sendSms(sendSmsRequest);         // Synchronously get the return value of the API request         SendSmsResponse resp = response.get();         System.out.println(new Gson().toJson(resp));         // Asynchronous processing of return values         /*response.thenAccept(resp -> {             System.out.println(new Gson().toJson(resp));         }).exceptionally(throwable -> { // Handling exceptions             System.out.println(throwable.getMessage());             return null;         });*/         // Finally, close the client         client.close();     } }

下面是PHP代码示例

<?php // This file is auto-generated, don't edit it. Thanks. namespace AlibabaCloud\SDK\Sample; use AlibabaCloud\SDK\Dysmsapi\V20170525\Dysmsapi; use \Exception; use AlibabaCloud\Tea\Exception\TeaError; use AlibabaCloud\Tea\Utils\Utils; use Darabonba\OpenApi\Models\Config; use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\SendSmsRequest; use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions; class Sample {     /**      * 使用AK&SK初始化账号Client      * @param string $accessKeyId      * @param string $accessKeySecret      * @return Dysmsapi Client      */     public static function createClient($accessKeyId, $accessKeySecret){         $config = new Config([             // 必填,您的 AccessKey ID             "accessKeyId" => $accessKeyId,             // 必填,您的 AccessKey Secret             "accessKeySecret" => $accessKeySecret         ]);         // 访问的域名         $config->endpoint = "dysmsapi.aliyuncs.com";         return new Dysmsapi($config);     }     /**      * @param string[] $args      * @return void      */     public static function main($args){         // 工程代码泄露可能会导致AccessKey泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议使用更安全的 STS 方式,更多鉴权访问方式请参见:https://help.aliyun.com/document_detail/311677.html        $client = self::createClient("accessKeyId", "accessKeySecret");         $sendSmsRequest = new SendSmsRequest([]);         $runtime = new RuntimeOptions([]);         try {             // 复制代码运行请自行打印 API 的返回值             $client->sendSmsWithOptions($sendSmsRequest, $runtime);         }         catch (Exception $error) {             if (!($error instanceof TeaError)) {                 $error = new TeaError([], $error->getMessage(), $error->getCode(), $error);             }             // 如有需要,请打印 error             Utils::assertAsString($error->message);         }     } } $path = __DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php'; if (file_exists($path)) {     require_once $path; } Sample::main(array_slice($argv, 1));


相关文章
|
JavaScript Java API
如何接入阿里云短信服务 (完整指南)
如何接入阿里云短信服务 (完整指南)
59576 1
wireshark解析rtp协议,流媒体中的AMR/H263/H264包的方法
抓到完整的流媒体包之后,用wireshark打开,其中的包可能不会自动映射成RTP+AMR/H263/H264的包,做如下修改操作即可:1.  把UDP 包解析成RTP/RTCP包。选中UDP包,右键,选择Decode As,选RTP2.  把RTP Payload映射成实际的媒体格式。
3856 0
|
6月前
|
弹性计算
阿里云账号注册、实名认证及免费云产品申请流程
阿里云账号注册、实名认证及免费云产品申请流程 1. 打开阿里云官网。 2. 点击网页右上角的“注册”按钮。 3. 注册方式支持手机短信验证码注册、支付宝注册、淘宝注册和钉钉注册四种。 4. 若选择手机号注册,需输入手机号并点击“获取验证码”,随后将手机收到的6位数字验证码输入,即可完成注册。
1212 6
|
7月前
|
JSON API 定位技术
万年历API接口详细教程:获取指定日12时辰详细信息
万年历“取指定日-12时辰详细信息”API提供免费、全面的农历及时辰数据,涵盖干支、五行、纳音、宜忌、方位等90余项命理信息,支持POST/GET请求,适用于算命、风水、日历类应用开发。
1253 0
|
数据采集 监控 安全
阿里云短信服务+图形认证,有效降低验证码盗刷概率
阿里云短信服务+图形认证服务,有效降低验证码盗刷概率。
1625 3
阿里云短信服务+图形认证,有效降低验证码盗刷概率
|
11月前
|
缓存 负载均衡 安全
Nginx反向代理详解
Nginx的反向代理和负载均衡可以保证后端服务器资源的安全以及各个服务器可以根据性能设置权重来控制服务器所接收的访问量,实现真正的负载均衡。
|
人工智能 Java 云计算
Salesforce X 阿里云:加速中国市场合作!
Salesforce X 阿里云:加速中国市场合作!
764 13
如何使用控制台群发短信 | 阿里云短信服务
操作指南|通过控制台群发短信
1445 14
|
安全 Java API
【三方服务集成】最新版 | 阿里云短信服务SMS使用教程(包含支持单双参数模板的工具类,拿来即用!)
阿里云短信服务提供API/SDK和控制台调用方式,支持验证码、通知、推广等短信类型。需先注册阿里云账号并实名认证,然后在短信服务控制台申请资质、签名和模板,并创建AccessKey。最后通过Maven引入依赖,使用工具类发送短信验证码。
8172 3
【三方服务集成】最新版 | 阿里云短信服务SMS使用教程(包含支持单双参数模板的工具类,拿来即用!)
|
SQL 安全 JavaScript
渗透测试之分享常用工具、插件和脚本(干货)
渗透测试之分享常用工具、插件和脚本(干货)
渗透测试之分享常用工具、插件和脚本(干货)