Пример #1
0
function sendSms($type, $phone, array $params = [])
{
    $types = ['register_verify' => ["注册验证", "SMS_3690282"], 'forgot_password_verify' => ["变更验证", "SMS_3690280"], 'phone_change' => ["身份验证", "SMS_3690285"], 'invite_registered' => ['智艺创想', 'SMS_5200318'], 'invite_anonymous' => ['智艺创想', 'SMS_5190328']];
    if (!isset($types[$type])) {
        return false;
    }
    array_walk($params, function (&$v) {
        $v = strval($v);
    });
    $c = new \ClusterTopClient('23289245', '1f32c93cfc513623f5457252b433c103');
    $req = new \AlibabaAliqinFcSmsNumSendRequest();
    $req->setSmsType("normal");
    $req->setSmsFreeSignName($types[$type][0]);
    $req->setSmsParam(json_encode($params));
    $req->setRecNum($phone);
    $req->setSmsTemplateCode($types[$type][1]);
    $resp = $c->execute($req);
    //print_r($resp);
    if ($resp && isset($resp->result) && isset($resp->result->err_code)) {
        return $resp->result->err_code == 0;
    } else {
        return false;
    }
}
Пример #2
0
 private function getDnsConfigSyncDuration()
 {
     if (ClusterTopClient::$cfgDuration) {
         return ClusterTopClient::$cfgDuration;
     }
     if (!ClusterTopClient::$dnsconfig) {
         return ClusterTopClient::$cfgDuration;
     }
     $config = json_encode(ClusterTopClient::$dnsconfig);
     if (!$config) {
         return ClusterTopClient::$cfgDuration;
     }
     $config = ClusterTopClient::$dnsconfig['config'];
     $duration = $config['interval'];
     ClusterTopClient::$cfgDuration = $duration;
     return ClusterTopClient::$cfgDuration;
 }
Пример #3
0
<?php

include "TopSdk.php";
date_default_timezone_set('Asia/Shanghai');
$httpdns = new HttpdnsGetRequest();
$client = new ClusterTopClient("4272", "0ebbcccfee18d7ad1aebc5b135ffa906");
$client->gatewayUrl = "http://api.daily.taobao.net/router/rest";
var_dump($client->execute($httpdns, "6100e23657fb0b2d0c78568e55a3031134be9a3a5d4b3a365753805"));
Пример #4
0
<?php

include "TopSdk.php";
date_default_timezone_set('Asia/Shanghai');
$httpdns = new HttpdnsGetRequest();
$client = new ClusterTopClient("appkey", "appscret");
$client->gatewayUrl = "http://gw.api.taobao.com/router/rest";
var_dump($client->execute($httpdns));