Details about how to use Alibaba big fish SMS

Source: Internet
Author: User
Provides various official and user-released code examples. For code reference, you are welcome to exchange and learn. I am completing the setup. If you want to use the text message verification function in the project, you will find the Ali big fish, the price seems to be the lowest at present. Everything else is easy to get. It is imported into the project. I don't know how to use it. I keep reporting errors. I checked it online. Most of them are the same as document cases. It's useless, there are also column examples in tp. It is estimated that they are both old and useless. Finally, let's record it here.
Download the SDK, decompress and introduce the Autoload. php, TopSdk. php, aliyun, and top folders.
The introduced location is APP_PATH/Common/Lib/Alidayu/. I think it is better not to move the tp file.
Create a new class file SendMSM. class. php based on your needs.

 Format = "json"; $ c-> appkey = C ('alidayuappkey'); $ c-> secretKey = C ('alidayuappsecret'); $ req = new AlibabaAliqinFcSmsNumSendRequest; // $ req-> setExtend ("123456"); $ req-> setSmsType ("normal"); $ req-> setSmsFreeSignName ($ smsFreeSignName ); $ req-> setSmsParam ($ smsParam); $ req-> setRecNum ($ recNum); $ req-> setSmsTemplateCode ($ smsTemplateCode ); $ resp = $ c-> execute ($ req); return $ resp ;}}

I put the AppKey and secret in a separate configuration file, so that they can be modified in the background after being reset.

And then,

 sendMSM();    }        protected function sendMSM(){        $alidayu = new SendMSM();        $result = $alidayu->send('13000000000','{"code":"123456"}');        dump($result);    }}

Test results:

object(stdClass)[11]  public 'result' =>     object(stdClass)[12]      public 'err_code' => string '0' (length=1)      public 'model' => string '101550887105^1102084861016' (length=26)      public 'success' => boolean true  public 'request_id' => string '12cl9hupqvkgh' (length=13)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.