loader

Documentation

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:8443/Translation",
 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 => [
  "Content-Type: application/json",
  "X-Key: *****-*****-*****-*****"
 ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

GitHub Class for PHP - https://github.com/slavawebkiev/CloudAPI.Stream

Class initialization

$CAS = new CAS;

Key installation

$CAS->set_key('******-*****-*****-*****');

Video on YouTube

https://youtu.be/YPSVJbHkQTc

Get a list of languages available for translation

$answer = $CAS->langs();

Answer

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"]=>...

Text translation

$answer = $CAS->translate('en','fr','Hi bro!');

translate(FROM_LAGUAGE_CODE,TO_LAGUAGE_CODE,TEXT);

Answer

array(3) { ["result"]=> bool(true) ["text"]=> string(15) "Salut mon pote!" ["times"]=> array(1) { ["total_time"]=> float(2.0059208869934) } }

Languages

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
"); infoWindow.open(map); map.setCenter(pos); }, () => { handleLocationError(true, infoWindow, map.getCenter()); } ); } else { // Browser doesn't support Geolocation handleLocationError(false, infoWindow, map.getCenter()); } }); new google.maps.Marker({ position: myLatLng, map, title: "
", }); } function addMarker(title,content,position) { const marker = new google.maps.Marker({ position: position, title: title, content: content }); google.maps.event.addListener(marker, 'click', function() { $('#place_modal .modal-body').html( this.content ); $('#place_modal').modal('show'); rating_load(); }); marker.setMap(map); markers.push(marker); } // Sets the map on all markers in the array. function setMapOnAll(map) { for (let i = 0; i < markers.length; i++) { markers[i].setMap(map); } } // Removes the markers from the map, but keeps them in the array. function hideMarkers() { setMapOnAll(null); } // Shows any markers currently in the array. function showMarkers() { setMapOnAll(map); } // Deletes all markers in the array by removing references to them. function deleteMarkers() { hideMarkers(); markers = []; } window.initMap = initMap; $(document).ready(function(){ $(".map_click").on('click',function(){ $.ajax({ type: "GET", url: url + "0&ajax=true&lng=0&lat=0", success: function(data) { deleteMarkers(); data_location = null; var centerLatLng = new google.maps.LatLng(data.lat, data.lng); center = parseFloat(data.lng); if( data.center == 1 ){ map.setZoom(13); // This will trigger a zoom_changed on the map map.setCenter( centerLatLng ); } //this.set('oldCenter',map.getCenter()); data.places.forEach(function(item) { addMarker(item.title,item.content,{ lat: parseFloat(item.lat), lng: parseFloat(item.lng) }); }); } }); }); var images_ = $('*[data-image-home]'); for(var i =0; i< images_.length;i++){ $(images_[i]).attr('src',$(images_[i]).attr('data-image-home')); } var langs = $('*[data-lang]'); var current_lang = 'en'; for(var i =0; i< langs.length;i++){ if( $(langs[i]).attr('data-lang') == current_lang ){ $('*[data-lang-set]').attr('src',$(langs[i]).attr('src')); } } reload_ajax(); $("*[data-confirm]").on('click',function(){ var t_id = 'temp' + Math.random(); var element_ = this; $(this).attr('data-temp',t_id); $("body").attr('data-temp-id',t_id); if( $(this).attr('data-block-ui') != undefined ){ block_ui( $(this).attr('data-block-ui') ); } Swal.fire({ title: "Are you sure?", text: "Are you sure you want to delete your review?", type: "warning", showCancelButton: true, confirmButtonColor: "#3085d6", cancelButtonColor: "#d33", confirmButtonText: "Yes, delete it!", }).then((result) => { if (result.value) { var t_id = $("body").attr('data-temp-id'); var element_ = $( "*[data-temp='" + $("body").attr('data-temp-id') + "']" ); $.post( $(element_).attr('data-action'), {temp: t_id, id: $(element_).attr('data-id'), value: $(element_).attr('data-value')}) .done(function( data ) { eval(data); }); } }); }); }); function block_ui( id ){ $(id).parents('.card').block({ message: '', timeout: 1000, //unblock after 2 seconds overlayCSS: { backgroundColor: "#000", opacity: 0.5, cursor: "wait", }, css: { border: 0, padding: 0, backgroundColor: "transparent", }, }); } const cookieConsent = new CookieConsent({ contentUrl: "/cookie-consent-content", // location of the language files privacyPolicyUrl: "", body: "We use cookies to personalize content and analyze traffic to our site. Cookies are also used for authorization on the site and display of advertising.", buttonSecondaryClass: "none_" }); //cookieConsent.reset();