翻译之家为你提供主流翻译引擎机器翻译技术
{{i}} - {{v}}
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'http://translate.codeai.net.cn/api/index/translate?token=你的token',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{"keywords":"hi","targetLanguage":"de"}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
curl --location 'http://translate.codeai.net.cn/api/index/translate?token=你的token' \
--header 'Content-Type: application/json' \
--data '{"keywords":"hi","targetLanguage":"de"}'
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"keywords\":\"hi\",\"targetLanguage\":\"de\"}");
Request request = new Request.Builder()
.url("http://translate.codeai.net.cn/api/index/translate?token=你的token")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
import requests
import json
url = "http://translate.codeai.net.cn/api/index/translate?token=qoPXgw4ISOvdV2tq"
payload = json.dumps({
"keywords": "hi",
"targetLanguage": "de"
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)