[Tutorial for Beginners] Complete version of the new version of SMS service Xiaobai tutorial (original Ali is greater than)

Recently, the functions of Alibaba Group have been quietly merged into the SMS service of Alibaba Cloud. Users who have newly opened the SMS service will no longer be able to use the previous API of Alibaba Group to send text messages. So, how should the new version of the SMS service be used? , please see this tutorial, take php as an example


. Real-name authentication is required to activate SMS service. If not, please authenticate first. Website: https://account.console.aliyun.com/?spm=5176.sms-account.101.245. 66e36218RmiLW#/auth/home


Then we open SMS service, portal: https://dysms.console.aliyun.com/dysms.htm?spm=5176.2020520001.1001.14.WwYevi#/account








Now we can start to apply for SMS signature, The location is: SMS Service--"SMS Signature--"Add SMS Signature.




So what is a SMS signature? Please see the picture below. The part in the red box is that a square bracket will be automatically added to the left and right of the signature. The


other content is the SMS template. Add to the template




Let 's add a SMS template. After adding the review, the applied SMS template id can be used normally.
The content in the red box in the figure below is the variable in the SMS, and we can set different values ​​in the code.




Finally , the appid and key of the original Alibaba Group are no longer available. We now need to use the accesskey of Alibaba Cloud to enter the SMS interface. call.
Get and record your own key id and key secret. Portal: https://ak-console.aliyun.com/#/accesskey




Okay, here, the application part has been completed, then, how can we use the php program to combine What about the signature and template we applied above to send a text message?
Interested friends can take a look at the interface documentation and study it slowly:
https://help.aliyun.com/document_detail/55284.html?spm=5176.sms-account.109.1.66e3621NHrsNh


Friends who are impatient, you can Download the demo directly and replace it with your own parameters for testing
Download URL: https://help.aliyun.com/document_detail/55359.html?spm=5176.doc55451.6.564.WlOV97


But there are 4 files in the downloaded php demo Folder, which contains the codes of all SMS interfaces, including sending, querying sending status, etc.
Sending SMS only needs the folders api_sdk and smsDemo.php, I have already made it independently, please download it in the attachment.
You need to change the parameters in smsDemo.php to your own parameters, open this page to send SMS (the appid and key in the code are expired, please replace them with your own application)




Finally, attach a few pictures and send them successfully The screenshots of , there are friends who need similar functions, you can achieve it.






SMS service php20170704.zip (43 K) Downloads: 3 














Share to Taojianghu Sina QQ Weibo QQ space Happy Renren Douban Netease Weibo Baidu Xianguobai Society Fetion
That city, that street, that me

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326307026&siteId=291194637