Документація
PHP Curl
$text = "Hello World";
$curl = curl_init();
$json = ['from'=>"en",'to'=>"de",'text'=>$text];
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cloudapi.stream/v2/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($json),
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-Key: *****-*****-*****-*****"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
Клас GitHub для PHP - https://github.com/slavawebkiev/CloudAPI.Stream
Ініціалізація класу
$CAS = new CAS;
Установка ключа
$CAS->set_key('******-*****-*****-*****');
Відео на YouTube
Отримайте список мов, доступних для перекладу
$answer = $CAS->langs();
Відповідь
array(3) {
["result"]=>
bool(true)
["langs"]=>
array(110) {
["af"]=>
string(9) "Afrikaans"
["am"]=>
string(7) "Amharic"
["ar"]=>
string(6) "Arabic"
["auto"]=>
string(15) "Detect Language"
["az"]=>
string(11) "Azerbaijani"
["be"]=>...
Переклад тексту
$answer = $CAS->translate('en','fr','Hi bro!');
translate(FROM_LAGUAGE_CODE,TO_LAGUAGE_CODE,TEXT);
Відповідь
array(3) {
["result"]=>
bool(true)
["text"]=>
string(15) "Salut mon pote!"
["times"]=>
array(1) {
["total_time"]=>
float(2.0059208869934)
}
}
Мови
af - Afrikaans
am - Amharic
ar - Arabic
auto - Detect Language
az - Azerbaijani
be - Belarusian
bg - Bulgarian
bn - Bengali
bs - Bosnian
ca - Catalan
ceb - Cebuano
co - Corsican
cs - Czech
cy - Welsh
da - Danish
de - German
el - Greek
en - English
eo - Esperanto
es - Spanish
et - Estonian
eu - Basque
fa - Persian
fi - Finnish
fr - French
fy - Frisian
ga - Irish
gd - Scots Gaelic
gl - Galician
gu - Gujarati
ha - Hausa
haw - Hawaiian
he - Hebrew
hi - Hindi
hmn - Hmong
hr - Croatian
ht - Haitian Creole
hu - Hungarian
hy - Armenian
id - Indonesian
ig - Igbo
is - Icelandic
it - Italian
iw - Hebrew
ja - Japanese
jw - Javanese
ka - Georgian
kk - Kazakh
km - Khmer
rw - Kinyarwanda
kn - Kannada
ko - Korean
ku - Kurdish (Kurmanji)
ky - Kyrgyz
la - Latin
lb - Luxembourgish
lo - Lao
lt - Lithuanian
lv - Latvian
mg - Malagasy
mi - Maori
mk - Macedonian
ml - Malayalam
mn - Mongolian
mr - Marathi
ms - Malay
mt - Maltese
my - Myanmar (Burmese)
ne - Nepali
nl - Dutch
no - Norwegian
or - Odia (Oriya)
ny - Chichewa
pa - Punjabi
pl - Polish
ps - Pashto
pt - Portuguese
ro - Romanian
ru - Russian
sd - Sindhi
si - Sinhala
sk - Slovak
sl - Slovenian
sm - Samoan
sn - Shona
so - Somali
sq - Albanian
sr - Serbian
st - Sesotho
su - Sundanese
sv - Swedish
sw - Swahili
ta - Tamil
tt - Tatar
te - Telugu
tg - Tajik
th - Thai
tl - Filipino
tr - Turkish
uk - Ukrainian
ur - Urdu
ug - Uyghur
uz - Uzbek
vi - Vietnamese
xh - Xhosa
yi - Yiddish
yo - Yoruba
zh-CN - Chinese (Simplified)
zh-TW - Chinese (Traditional)
zu - Zulu