cURL 复制
curl -X POST "https://cx4.cn/openApi/life/height" -H "X-Api-Key: 你的SecretKey" -d "father_height=175&mother_height=162&gender=male&method=cmh¤t_height=120¤t_age=8"
JavaScript 复制
fetch('https://cx4.cn/openApi/life/height', {
method: 'POST',
headers: {
'X-Api-Key': '你的SecretKey',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: 'father_height=175&mother_height=162&gender=male&method=cmh¤t_height=120¤t_age=8'
})
.then(res => res.json())
.then(data => console.log(data));
PHP 复制
post('https://cx4.cn/openApi/life/height', [
'headers' => ['X-Api-Key' => '你的SecretKey'],
'form_params' => ['father_height' => '175', 'mother_height' => '162', 'gender' => 'male', 'method' => 'cmh', 'current_height' => '120', 'current_age' => '8'],
]);
echo $response->getBody();
Java 复制
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://cx4.cn/openApi/life/height"))
.header("X-Api-Key", "你的SecretKey")
.header("Content-Type", "application/x-www-form-urlencoded")
.POST(HttpRequest.BodyPublishers.ofString("father_height=175&mother_height=162&gender=male&method=cmh¤t_height=120¤t_age=8"))
.build();
HttpResponse response = client.send(
request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Python 复制
import requests
res = requests.post('https://cx4.cn/openApi/life/height',
headers={'X-Api-Key': '你的SecretKey'},
data={'father_height': '175', 'mother_height': '162', 'gender': 'male', 'method': 'cmh', 'current_height': '120', 'current_age': '8'})
print(res.json())