API 接口测试
API 接口测试
API 使用说明
接口地址:api.php
请求方式:GET
返回格式:JSON
成功返回示例:
{
"success": true,
"phone_number": "13800138000",
"id": 1,
"message": "获取成功"
}
失败返回示例:
{
"success": false,
"phone_number": null,
"message": "没有可用的手机号"
}
cURL 调用示例:
curl http://your-domain/api.php
JavaScript 调用示例:
fetch('api.php')
.then(r => r.json())
.then(d => console.log(d));
PHP 调用示例:
$ch = curl_init('http://your-domain/api.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
$data = json_decode($result, true);