基于 Google libphonenumber · 完全本地解析 · 无需第三方 API
POST /api/parse
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| phone | string | 是 | 手机号码 |
| country | string | 否 | 国家代码,默认 CN |
| 字段 | 类型 | 说明 |
|---|---|---|
| is_valid | boolean | 号码是否有效 |
| is_possible | boolean | 号码长度是否可能 |
| type_display | string | 号码类型(中文) |
| carrier | string | 运营商 |
| geo_name | string | 归属地 |
| timezone | string | 时区 |
| formats | object | 各格式号码(E.164/国际/国内) |
curl -X POST https://phone.aink.me/api/parse \
-H "Content-Type: application/json" \
-d '{"phone": "13800138000", "country": "CN"}'
fetch('/api/parse', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ phone: '13800138000', country: 'CN' })
})
.then(res => res.json())
.then(data => {
console.log('有效:', data.is_valid);
console.log('运营商:', data.carrier);
});
import requests
resp = requests.post('https://phone.aink.me/api/parse',
json={'phone': '13800138000', 'country': 'CN'})
result = resp.json()
print(result['carrier'], result['geo_name'])
'13800138000', 'country' => 'CN'];
$ch = curl_init('https://phone.aink.me/api/parse');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$resp = json_decode(curl_exec($ch), true);
echo $resp['carrier'];
?>
{
"is_valid": true,
"type_display": "移动电话",
"carrier": "中国移动",
"geo_name": "北京市",
"timezone": "Asia/Shanghai",
"formats": {
"e164": "+8613800138000",
"national": "138 0013 8000"
}
}