cURL 复制
curl -X POST "https://cx4.cn/openApi/data/hanzi" -H "X-Api-Key: 你的SecretKey" -d "word=初&pinyin=chu&radicals=木&strokes=5&limit=10"
JavaScript 复制
fetch('https://cx4.cn/openApi/data/hanzi', {
method: 'POST',
headers: {
'X-Api-Key': '你的SecretKey',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: 'word=初&pinyin=chu&radicals=木&strokes=5&limit=10'
})
.then(res => res.json())
.then(data => console.log(data));
PHP 复制
post('https://cx4.cn/openApi/data/hanzi', [
'headers' => ['X-Api-Key' => '你的SecretKey'],
'form_params' => ['word' => '初', 'pinyin' => 'chu', 'radicals' => '木', 'strokes' => '5', 'limit' => '10'],
]);
echo $response->getBody();
Java 复制
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://cx4.cn/openApi/data/hanzi"))
.header("X-Api-Key", "你的SecretKey")
.header("Content-Type", "application/x-www-form-urlencoded")
.POST(HttpRequest.BodyPublishers.ofString("word=初&pinyin=chu&radicals=木&strokes=5&limit=10"))
.build();
HttpResponse response = client.send(
request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Python 复制
import requests
res = requests.post('https://cx4.cn/openApi/data/hanzi',
headers={'X-Api-Key': '你的SecretKey'},
data={'word': '初', 'pinyin': 'chu', 'radicals': '木', 'strokes': '5', 'limit': '10'})
print(res.json())