cURL 复制
curl -X POST "https://www.cx4.cn/openApi/ai/body_measure" -H "X-Api-Key: 你的SecretKey" -d "image_front=https://example.com/front.jpg&image_back=https://example.com/back.jpg&image_side=https://example.com/side.jpg&height=170&weight=65&gender=male&age=28&async=0&callback_url=https://example.com/cb"
JavaScript 复制
fetch('https://www.cx4.cn/openApi/ai/body_measure', {
method: 'POST',
headers: {
'X-Api-Key': '你的SecretKey',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: 'image_front=https://example.com/front.jpg&image_back=https://example.com/back.jpg&image_side=https://example.com/side.jpg&height=170&weight=65&gender=male&age=28&async=0&callback_url=https://example.com/cb'
})
.then(res => res.json())
.then(data => console.log(data));
PHP 复制
<?php
require 'vendor/autoload.php';
$client = new \GuzzleHttp\Client();
$response = $client->post('https://www.cx4.cn/openApi/ai/body_measure', [
'headers' => ['X-Api-Key' => '你的SecretKey'],
'form_params' => ['image_front' => 'https://example.com/front.jpg', 'image_back' => 'https://example.com/back.jpg', 'image_side' => 'https://example.com/side.jpg', 'height' => '170', 'weight' => '65', 'gender' => 'male', 'age' => '28', 'async' => '0', 'callback_url' => 'https://example.com/cb'],
]);
echo $response->getBody();
Java 复制
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://www.cx4.cn/openApi/ai/body_measure"))
.header("X-Api-Key", "你的SecretKey")
.header("Content-Type", "application/x-www-form-urlencoded")
.POST(HttpRequest.BodyPublishers.ofString("image_front=https://example.com/front.jpg&image_back=https://example.com/back.jpg&image_side=https://example.com/side.jpg&height=170&weight=65&gender=male&age=28&async=0&callback_url=https://example.com/cb"))
.build();
HttpResponse<String> response = client.send(
request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Python 复制
import requests
res = requests.post('https://www.cx4.cn/openApi/ai/body_measure',
headers={'X-Api-Key': '你的SecretKey'},
data={'image_front': 'https://example.com/front.jpg', 'image_back': 'https://example.com/back.jpg', 'image_side': 'https://example.com/side.jpg', 'height': '170', 'weight': '65', 'gender': 'male', 'age': '28', 'async': '0', 'callback_url': 'https://example.com/cb'})
print(res.json())