phpインタフェース、認証免除メールインタフェース、毎日単一番号140本以上
8549 ワード
kewailプラットフォームのメールphpインタフェースを紹介します.公式サイトリンク:www.kewail.com
//Works well with php5.3 and php5.6.
namespace Kewail\Sms;
require_once('SmsSenderUtil.php');
class SmsSingleSender {var $url;var $accesskey;var $secretkey;var $util;
/要求パケット体{"tel":{"nationcode":"86","mobile":"137888888"},"type":0,"msg":"あなたの検証コードは1234","sig":"fdba654 e 05 bc 0 d 15796713 a 1 a 1 a 1 a 2318 c","time":1414799888540,"extend"","ext":""""""""""}応答パケット体{"result":0,"errmsg":"OK","ext":","sit":","sisit","sisisit":","sisit":""","sit""""","sisit"":"""""""d]:“xxxxxx”,“fee”:1}/$random=$this->util->getRandom();$curTime = time();$wholeUrl = $this->url . "?accesskey=". $this->accesskey . "&random=". $random;
/要求パケット体{"tel":{"nationcode":"86","mobile":"137888888"},"sign":"Kewail","tpl_id":19,"params":["検証コード","1234","4"","sig":"fdba 654 e 05 bc 0 d 15796713 a 1 a 1 a 1 a 2318 c","time":14799888540,"extend"""","ext":""""""""}応答パケット体{result":::::::{0,「errmsg」:「OK」,「ext」:「」,「sid」:「xxxxxx」,「fee」:1}/$random=$this->util->getRandom();$curTime = time();$wholeUrl = $this->url . "?sdkaccesskey=". $this->accesskey . "&random=". $random;
}
class SmsMultiSender {var $url;var $accesskey;var $secretkey;var $util;
/要求パッケージ{"tel":[{"nationcode":"86","mobile":"137888888"},{"nationcode":"86","mobile":"137888889"}],"type":0,"msg":"あなたの検証コードは1234","sig":"fdba 654 e 05 bc 0 d 15796713 a 1 a 1 a 2318 c","time":147888540,"extend","「ext」:「」}応答パッケージ{「result」:0,「errmsg」:「OK」,「ext」:「」,「detail」:[{「result」:0,「errmsg」:「OK」,「mobile」:「13788888888888888」,「nationcode」:「86」,「sid」:「xxxxxxx」,「fee」:1},{「result」:0,「errmsg」:「OK」,「mobile」:「1378888888888888889」,「nationcode」:「nationcode」,「nationcode code」":"86","sid":"xxxxxx","fee":}/$random=$this->util->getRandom();curTime = time();$wholeUrl = $this->url . "?accesskey=". $this->accesskey . "&random=". $random;$data = new\stdClass();$data->tel = $this->util->phoneNumbersToArray($nationCode, $phoneNumbers);$data->type = $type;$data->msg = $msg;$data->sig = $this->util->calculateSig($this->secretkey, $random, $curTime, $phoneNumbers);$data->time = $curTime;$data->extend = $extend;$data->ext = $ext;return $this->util->sendCurlPost($wholeUrl, $data);}
/要求包体{"tel":[{"nationcode":"86","mobile":"137888888"},{"nationcode":":""86","mobile":"13788888889"}],"sign":"Kewail","tpl_id":19,"params":["検証コード","1234","4"],"4","sig":"fdba654 e 05 bc 0 d 15796713 a 1 a 1 a 2318 c","time":98148888888888888888888888888888888 c","time":981488888888888888888888888888888888888888888888888"///540,「extend」:「」,「ext」:「」}応答パッケージ{「result」:0,「errmsg」:「OK」,「ext」:「」,「detail」:[{「result」:0,「errmsg」:「OK」,「mobile」:「13788888888888888」,「nationcode」:「86」,「sid」:「xxxxxxx」,「fee」:1},{「result」:0,「errmsg」:「OK」,「mobile」:「1378888888888888889」,「nationcode」:「nationcode」,「nationcode code」":"86","sid":"xxxxxx","fee":}/$random=$this->util->getRandom();curTime = time();$wholeUrl = $this->url . "?accesskey=". $this->accesskey . "&random=". $random;$data = new\stdClass();$data->tel = $this->util->phoneNumbersToArray($nationCode, $phoneNumbers);$data->sign = $sign;$data->tpl_id = $templId;$data->params = $params;$data->sig = $this->util->calculateSigForTemplAndPhoneNumbers($this->secretkey, $random, $curTime, $phoneNumbers);$data->time = $curTime;$data->extend = $extend;$data->ext = $ext;return $this->util->sendCurlPost($wholeUrl, $data);}}
詳細については、クラウドサービス-Kewailテクノロジー公式サイトへようこそ:https://www.kewail.com/認証免除専用登録:https://www.kewail.com/register.html?uid=1542971565991
//Works well with php5.3 and php5.6.
namespace Kewail\Sms;
require_once('SmsSenderUtil.php');
class SmsSingleSender {var $url;var $accesskey;var $secretkey;var $util;
function __construct($accesskey, $secretkey) {
$this->url = "https://live.kewail.com/sms/v1/sendsinglesms";
$this->accesskey = $accesskey;
$this->secretkey = $secretkey;
$this->util = new SmsSenderUtil();
}
/**
* , , , 【】 ,
* @param int $type ,0 ,1
* @param string $nationCode , 86
* @param string $phoneNumber
* @param string $msg , ,
* @param string $extend ,
* @param string $ext ,
* @return string json string { "result": xxxxx, "errmsg": "xxxxxx" ... },
*/
function send($type, $nationCode, $phoneNumber, $msg, $extend = "", $ext = "") {
/要求パケット体{"tel":{"nationcode":"86","mobile":"137888888"},"type":0,"msg":"あなたの検証コードは1234","sig":"fdba654 e 05 bc 0 d 15796713 a 1 a 1 a 1 a 2318 c","time":1414799888540,"extend"","ext":""""""""""}応答パケット体{"result":0,"errmsg":"OK","ext":","sit":","sisit","sisisit":","sisit":""","sit""""","sisit"":"""""""d]:“xxxxxx”,“fee”:1}/$random=$this->util->getRandom();$curTime = time();$wholeUrl = $this->url . "?accesskey=". $this->accesskey . "&random=". $random;
// post
$data = new \stdClass();
$tel = new \stdClass();
$tel->nationcode = "".$nationCode;
$tel->mobile = "".$phoneNumber;
$data->tel = $tel;
$data->type = (int)$type;
$data->msg = $msg;
$data->sig = hash("sha256",
"secretkey=".$this->secretkey."&random=".$random."&time=".$curTime."&mobile=".$phoneNumber, FALSE);
$data->time = $curTime;
$data->extend = $extend;
$data->ext = $ext;
return $this->util->sendCurlPost($wholeUrl, $data);
}
/**
*
* @param string $nationCode , 86
* @param string $phoneNumber
* @param int $templId id
* @param array $params , {1}...{2}...{3},
* @param string $sign , ,
* @param string $extend ,
* @param string $ext ,
* @return string json string { "result": xxxxx, "errmsg": "xxxxxx" ... },
*/
function sendWithParam($nationCode, $phoneNumber, $templId = 0, $params, $sign = "", $extend = "", $ext = "") {
/要求パケット体{"tel":{"nationcode":"86","mobile":"137888888"},"sign":"Kewail","tpl_id":19,"params":["検証コード","1234","4"","sig":"fdba 654 e 05 bc 0 d 15796713 a 1 a 1 a 1 a 2318 c","time":14799888540,"extend"""","ext":""""""""}応答パケット体{result":::::::{0,「errmsg」:「OK」,「ext」:「」,「sid」:「xxxxxx」,「fee」:1}/$random=$this->util->getRandom();$curTime = time();$wholeUrl = $this->url . "?sdkaccesskey=". $this->accesskey . "&random=". $random;
// post
$data = new \stdClass();
$tel = new \stdClass();
$tel->nationcode = "".$nationCode;
$tel->mobile = "".$phoneNumber;
$data->tel = $tel;
$data->sig = $this->util->calculateSigForTempl($this->secretkey, $random, $curTime, $phoneNumber);
$data->tpl_id = $templId;
$data->params = $params;
$data->sign = $sign;
$data->time = $curTime;
$data->extend = $extend;
$data->ext = $ext;
return $this->util->sendCurlPost($wholeUrl, $data);
}
}
class SmsMultiSender {var $url;var $accesskey;var $secretkey;var $util;
function __construct($accesskey, $secretkey) {
$this->url = "https://live.kewail.com/sms/v1/sendsinglesms";
$this->accesskey = $accesskey;
$this->secretkey = $secretkey;
$this->util = new SmsSenderUtil();
}
/**
* , , , 【】 ,
* 【 】
* @param int $type ,0 ,1
* @param string $nationCode , 86
* @param string $phoneNumbers
* @param string $msg , ,
* @param string $extend ,
* @param string $ext ,
* @return string json string { "result": xxxxx, "errmsg": "xxxxxx" ... },
*/
function send($type, $nationCode, $phoneNumbers, $msg, $extend = "", $ext = "") {
/要求パッケージ{"tel":[{"nationcode":"86","mobile":"137888888"},{"nationcode":"86","mobile":"137888889"}],"type":0,"msg":"あなたの検証コードは1234","sig":"fdba 654 e 05 bc 0 d 15796713 a 1 a 1 a 2318 c","time":147888540,"extend","「ext」:「」}応答パッケージ{「result」:0,「errmsg」:「OK」,「ext」:「」,「detail」:[{「result」:0,「errmsg」:「OK」,「mobile」:「13788888888888888」,「nationcode」:「86」,「sid」:「xxxxxxx」,「fee」:1},{「result」:0,「errmsg」:「OK」,「mobile」:「1378888888888888889」,「nationcode」:「nationcode」,「nationcode code」":"86","sid":"xxxxxx","fee":}/$random=$this->util->getRandom();curTime = time();$wholeUrl = $this->url . "?accesskey=". $this->accesskey . "&random=". $random;$data = new\stdClass();$data->tel = $this->util->phoneNumbersToArray($nationCode, $phoneNumbers);$data->type = $type;$data->msg = $msg;$data->sig = $this->util->calculateSig($this->secretkey, $random, $curTime, $phoneNumbers);$data->time = $curTime;$data->extend = $extend;$data->ext = $ext;return $this->util->sendCurlPost($wholeUrl, $data);}
/**
*
* 【 】
* @param string $nationCode , 86
* @param array $phoneNumbers
* @param int $templId id
* @param array $params , {1}...{2}...{3},
* @param string $sign , ,
* @param string $extend ,
* @param string $ext ,
* @return string json string { "result": xxxxx, "errmsg": "xxxxxx" ... },
*/
function sendWithParam($nationCode, $phoneNumbers, $templId, $params, $sign = "", $extend ="", $ext = "") {
/要求包体{"tel":[{"nationcode":"86","mobile":"137888888"},{"nationcode":":""86","mobile":"13788888889"}],"sign":"Kewail","tpl_id":19,"params":["検証コード","1234","4"],"4","sig":"fdba654 e 05 bc 0 d 15796713 a 1 a 1 a 2318 c","time":98148888888888888888888888888888888 c","time":981488888888888888888888888888888888888888888888888"///540,「extend」:「」,「ext」:「」}応答パッケージ{「result」:0,「errmsg」:「OK」,「ext」:「」,「detail」:[{「result」:0,「errmsg」:「OK」,「mobile」:「13788888888888888」,「nationcode」:「86」,「sid」:「xxxxxxx」,「fee」:1},{「result」:0,「errmsg」:「OK」,「mobile」:「1378888888888888889」,「nationcode」:「nationcode」,「nationcode code」":"86","sid":"xxxxxx","fee":}/$random=$this->util->getRandom();curTime = time();$wholeUrl = $this->url . "?accesskey=". $this->accesskey . "&random=". $random;$data = new\stdClass();$data->tel = $this->util->phoneNumbersToArray($nationCode, $phoneNumbers);$data->sign = $sign;$data->tpl_id = $templId;$data->params = $params;$data->sig = $this->util->calculateSigForTemplAndPhoneNumbers($this->secretkey, $random, $curTime, $phoneNumbers);$data->time = $curTime;$data->extend = $extend;$data->ext = $ext;return $this->util->sendCurlPost($wholeUrl, $data);}}
詳細については、クラウドサービス-Kewailテクノロジー公式サイトへようこそ:https://www.kewail.com/認証免除専用登録:https://www.kewail.com/register.html?uid=1542971565991