Hi
Yn gyntaf, rwy'n becouse deeple ddrwg o linell o'i le yn Microsoft Cyfieithu gan Aure, os gwelwch yn dda defnyddiwch y cod i brofi ei fod yn briodol:
PHP Code:
<?php
require_once('./global.php');
function get_token(){
global $vbulletin;
$obj_connection = curl_init();
$arr_query_bits = array (
'grant_type' => 'client_credentials',
'scope' => 'http://api.microsofttranslator.com',
'client_id' => $vbulletin->options['vbenterprisetranslator_Microsoft_key'],
'client_secret' => $vbulletin->options['vbenterprisetranslator_Microsoft_secret']
);
$str_query = http_build_query($arr_query_bits);
curl_setopt($obj_connection, CURLOPT_URL, 'https://datamarket.accesscontrol.windows.net/v2/OAuth2-13');
curl_setopt($obj_connection, CURLOPT_HEADER, 0);
curl_setopt($obj_connection, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($obj_connection, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($obj_connection, CURLOPT_POSTFIELDS, $str_query);
curl_setopt($obj_connection, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($obj_connection, CURLOPT_POST, TRUE);
print_r('Full token: </br>'.curl_exec($obj_connection).'</br></br>');
$token = json_decode (curl_exec($obj_connection));
curl_close($obj_connection);
return 'Authorization: Bearer '.$token->{'access_token'};
}
echo 'Starting test for Microsft Translation API by Azure<br/><br/>';
$connection = curl_init();
curl_setopt($connection, CURLOPT_URL, 'http://api.microsofttranslator.com/V2/Ajax.svc/Translate?&from=pl&to=en&text=Witaj!');
curl_setopt($connection, CURLOPT_HEADER, 0);
curl_setopt($connection, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($connection, CURLOPT_HTTPHEADER, array(get_token()));
$str_response = curl_exec($connection);
$time = microtime(true) * 1000;
$result = curl_exec($connection);
$time = microtime(true) * 1000 - $time;
echo 'Test result: '.$result."<br/>\n";
echo 'Test error: '.curl_error($connection)."<br/>\n";
curl_close($connection);
echo 'Connection time (ms): '.$time;
?>
Hefyd, nid oes API Google v1 Translotion API ar hyn o bryd - Google wedi cau ei
.
Am eich mater - byddaf yn gallu dweud mwy ar ôl y prawf. Ond ar hyn o bryd, a allech ddweud wrthyf os ydych yn defnyddio cache / cache gust? Dylai Becouse vBET ddefnyddio tudalennau unwaith cyfieithu pan fyddwch allan gwota od. Ar ben hynny, nodwch na allwch ddefnyddio'r ddau Microsft (hen) a Microsoft gan asur API - (er bod prawf yn iawn) Os ydych yn rhoi allweddi i ddau ei, bydd vBET yn dewis Microsoft Cyfieithu gan asur awtomatig - felly os gwelwch yn dda yn cael ei Shure i chi ' wedi creu eich cyfrif asur briodol: Chi ddim tanysgrifio ar gyfer cyfieithydd a ydych wedi eich cofrestru Aplication