身份证二要素验证
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| apikey | string | 是 | 请求密钥key |
| merchantCode | string | 是 | 商户号 |
| chName | string | 是 | 用户名 |
| idNum | string | 是 | 身份证号 |
| idType | string | 是 | 证件类型 01身份证 |
| merchantTraceNo | string | 是 | 商户交易流水号32位 yyyyMMdd+15位商户编号+9位序列号 |
| 状态码 | 说明 |
|---|---|
| 200 | 请求成功,服务器已成功处理了请求。 |
| 403 | 服务器拒绝请求。这可能是由于缺少必要的认证凭据(如API密钥)或权限不足。 |
| 404 | 请求的资源未找到。请检查您的请求地址是否正确。 |
| 429 | 请求过于频繁。您已超出速率限制,请稍后再试。 |
| 500 | 服务器内部错误。服务器在执行请求时遇到了问题。 |
此处将显示接口返回结果...
import java.io.*;
import java.net.*;
import java.nio.charset.StandardCharsets;
public class ApiPostExample {
public static void main(String[] args) throws Exception {
String url = "https://xmssjh.cn/API/secondCardAnalyze.php";
StringBuilder postData = new StringBuilder();
postData.append("apikey=" + URLEncoder.encode("YOUR_VALUE", "UTF-8") + "&");
postData.append("merchantCode=" + URLEncoder.encode("YOUR_VALUE", "UTF-8") + "&");
postData.append("chName=" + URLEncoder.encode("YOUR_VALUE", "UTF-8") + "&");
postData.append("idNum=" + URLEncoder.encode("YOUR_VALUE", "UTF-8") + "&");
postData.append("idType=" + URLEncoder.encode("YOUR_VALUE", "UTF-8") + "&");
postData.append("merchantTraceNo=" + URLEncoder.encode("YOUR_VALUE", "UTF-8") + "&");
if (postData.length() > 0) postData.deleteCharAt(postData.length() - 1); // 去掉最后一个 &
byte[] postBytes = postData.toString().getBytes(StandardCharsets.UTF_8);
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestProperty("Content-Length", String.valueOf(postBytes.length));
try (OutputStream os = conn.getOutputStream()) {
os.write(postBytes);
}
int status = conn.getResponseCode();
System.out.println("HTTP Status: " + status);
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
StringBuilder response = new StringBuilder();
while ((line = in.readLine()) != null) {
response.append(line);
}
in.close();
System.out.println(response.toString());
}
}
<?php
$url = 'https://xmssjh.cn/API/secondCardAnalyze.php';
$params = [
'apikey' => 'YOUR_VALUE',
'merchantCode' => 'YOUR_VALUE',
'chName' => 'YOUR_VALUE',
'idNum' => 'YOUR_VALUE',
'idType' => 'YOUR_VALUE',
'merchantTraceNo' => 'YOUR_VALUE',
];
// 使用 application/x-www-form-urlencoded POST
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($response === false) {
echo 'CURL error: ' . curl_error($ch);
} else {
echo "HTTP Status: {$httpCode}\n";
echo $response;
}
curl_close($ch);
?>
import requests
url = "https://xmssjh.cn/API/secondCardAnalyze.php"
data = {
'apikey': 'YOUR_VALUE',
'merchantCode': 'YOUR_VALUE',
'chName': 'YOUR_VALUE',
'idNum': 'YOUR_VALUE',
'idType': 'YOUR_VALUE',
'merchantTraceNo': 'YOUR_VALUE',
}
# application/x-www-form-urlencoded POST
resp = requests.post(url, data=data)
print('HTTP Status:', resp.status_code)
print(resp.text)
const url = 'https://xmssjh.cn/API/secondCardAnalyze.php';
const params = {
'apikey': 'YOUR_VALUE',
'merchantCode': 'YOUR_VALUE',
'chName': 'YOUR_VALUE',
'idNum': 'YOUR_VALUE',
'idType': 'YOUR_VALUE',
'merchantTraceNo': 'YOUR_VALUE',
};
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams(params)
})
.then(res => {
console.log('HTTP Status:', res.status);
return res.text();
})
.then(text => console.log(text))
.catch(err => console.error('Error:', err));