短信验证码
调用其他平台进行验证码派发/验证。

接口地址: https://myapi.2su.cc/api/dxyzm

返回格式: JSON

请求方式: GET

请求示例: https://myapi.2su.cc/api/dxyzm?apiKey=用户中心apiKey&act=getCode&phone=18888888888

请求参数说明:

名称 必填 类型 说明
act string 行为:getCode(发送验证码) | isCode(校验验证码)
phone string 手机号
code string 验证码
pf int 平台(不填则随机平台):1风鸟  2微短信  3序列猴子  4奇妙元 5Apowersoft

返回参数说明:

名称 类型 说明
code int 状态码
msg string 信息

返回示例:

{
  "code": 200,
  "msg": "验证码发送成功!"
}

请求参数设置:

参数名称 参数值


{
  "code": 200,
  "msg": "验证码发送成功!"
}

错误码格式说明:

名称 类型 说明
code int 错误码:-1/-2/-3

代码示例:

<?php

//定义参数数组
$params = array(
'apiKey' => '用户中心apiKey',
'phone' => '18888888888'
);

//拼接参数字符串
$query = "?" . http_build_query($params);

//创建curl对象
$curl = curl_init();

//设置curl选项
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://myapi.2su.cc/api/dxyzm' . $query,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));

//执行curl请求
$response = curl_exec($curl);

//关闭curl对象
curl_close($curl);

//输出响应结果
echo $response;