PHP code example of wengoldwu / alibaba

1. Go to this page and download the library: Download wengoldwu/alibaba library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wengoldwu / alibaba example snippets



use alibaba\Api\alibaba\sms\AlibabaSms;
use alibaba\Api\alibaba\email\EmailSend;
use alibaba\Api\alibaba\email\AcsClient;

//api发送邮件
$config = [
    'accessKeyId'=>'',
    'accessKeySecret'=>'',
    'accountName'=>'',
    'fromAlias'=>'',
];
$client = new AcsClient($config);
$response = $client->singleSendMail('正文','主题','接收邮箱','昵称');

//api短信
$config = [
    'accessKeyId'=> '',
    'accessKeySecret'=> '',
    'signName'=> '',
    'templateCode'=> '',
];
$alibabaSms = new AlibabaSms($config);
$send = $alibabaSms ->send_verify('手机号',['code'=>112]);

//PHPMailer发送邮件 (成功返回1 ,否则为false)
$EmailSend = EmailSend::send_mail('接收邮箱', '主题', '正文');

// 返回结果
print_r($EmailSend);
print_r($send);
print_r($response);