空號(hào)檢測 API
概覽
空號(hào)檢測是 SUBMAIL 的號(hào)碼篩選 API,根據(jù)提交的號(hào)碼來判斷號(hào)碼是否正常。
URL
http://tpa.mysubmail.com/mdetect/batchCheck
http 請(qǐng)求方式
請(qǐng)求方式 | content-type 設(shè)置 |
---|---|
http post | multipart/form-data 、x-www-form-urlencoded 、application/json |
請(qǐng)求參數(shù)
參數(shù) | 類型 | 必需/可選** | 默認(rèn) | 描述 |
---|---|---|---|---|
appid | string | 必需 | 無 | 應(yīng)用 appid,自控制臺(tái)獲取 |
timestamp | string | 可選 | 無 | Unix時(shí)間戳 |
sign_type | string | 可選 | 無 | 加密方式,可選值md5、sha1、sha256 |
mobiles | json array | 必需 | 無 | 要驗(yàn)證的號(hào)碼,JSON數(shù)組類型,最大支持50個(gè)號(hào)碼 |
signature | string | 必需 | 無 | sha256 數(shù)據(jù)加密校驗(yàn)證書 |
signature創(chuàng)建規(guī)則
1.請(qǐng)將以下參數(shù)按順序連接
appid+appkey+timestamp(字符串不包括加號(hào))
2.使用對(duì)應(yīng)的加密方式對(duì)字符串加密
PHP代碼示例
<?php
$post_data['timestamp'] = time();
$post_data['appid'] = 'appid';
$appkey= 'appkey';
$post_data['mobiles'] = json_encode(array("18612345678","152012345678","10901893074"));
$post_data['sign_type'] = "sha256";
$post_data['signature'] = hash('sha256',$post_data['appid'].$appkey.$post_data['timestamp']);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://tpa.mysubmail.com/mdetect/batchCheck",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => http_build_query($post_data),
CURLOPT_HTTPHEADER => array(
"Content-Type: application/x-www-form-urlencoded",
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
print_r(json_decode($response,true));
print_r($err);
成功返回
/*
status狀態(tài)描述
狀態(tài):0-空號(hào),1-實(shí)號(hào),2-停機(jī),3-庫無,4-沉默號(hào),5-風(fēng)險(xiǎn)號(hào),9-無效號(hào)碼
*/
{
"status": "success",//接口狀態(tài)
"code": 0,//錯(cuò)誤碼
"data": [
{
"fee": 1,//是否計(jì)費(fèi)
"mobile": "152012345678",
"area": "上海-上海",
"type": "中國移動(dòng)",
"status": "1"//號(hào)碼狀態(tài)
},
{
"fee": 1,
"mobile": "18612345678",
"area": "上海-上海",
"type": "中國聯(lián)通",
"status": "1"
},
{
"fee": 0,
"message": "Invalid mobile number",
"mobile": "10901893074",
"status": "9"
}
],
"feeCount": 2//計(jì)費(fèi)總數(shù)
}
請(qǐng)求失敗
/*
錯(cuò)誤碼解釋
1401:appid不正確
1402:無效的時(shí)間戳
1403:signature不正確
1404:appid已禁用
1405:IP白名單限制
1406:賬戶不存在或已注銷
1407:賬戶已禁用
1408:服務(wù)已禁用
1409:號(hào)碼參數(shù)不正確
1410:余額不足
1411:號(hào)碼數(shù)量超過50個(gè)
*/
{
"status": "error",
"code": 1403,
"msg": "Invalid signature with Normal"
}
status:接口狀態(tài) code:錯(cuò)誤代碼 msg:錯(cuò)誤信息