收集接口测试

收集接口测试

API 使用说明

接口地址:collect.php

请求方式:POST

Content-Type:application/json

请求体大小限制:64KB

必填字段:仅 phone_number(11 位中国大陆手机号),其余 6 项可选

返回示例:

{
    "success": true,
    "id": 1,
    "message": "数据收集成功"
}

cURL 示例:

curl -X POST http://your-domain/collect.php \
  -H "Content-Type: application/json" \
  -d '{"is_registered":"yes","nickname":"张三","user_id":"10086","user_level":"5","phone_number":"13800138000","online_today":"yes"}'

JavaScript 示例:

fetch('collect.php', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
        is_registered: 'yes',
        nickname: '张三',
        user_id: '10086',
        user_level: 'Lv.5',
        phone_number: '13800138000',
        online_today: 'yes',
        address: '北京市朝阳区'
    })
}).then(r => r.json()).then(d => console.log(d));

Python 示例:

import requests
r = requests.post('http://your-domain/collect.php', json={
    'is_registered': 'yes',
    'nickname': '张三',
    'user_id': '10086',
    'user_level': 'Lv.5',
    'phone_number': '13800138000',
    'online_today': 'yes',
    'address': '北京市朝阳区'
})
print(r.json())