Hi
First, I'm deeple sorry becouse of wrong line in Microsoft Translation by Aure, please use this code to test it properly:
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;
?>
Also there is no Google API v1 Translotion API right now - Google has closed it
.
About your issue - I will be able to say more after the test. But right now, could you tell me if you are using cache/gust cache? Becouse vBET should use once translated pages when you are out od quota. Moreover please note that you can not use both Microsft (old) and Microsoft by Azure API -(even though test is ok) If you put keys to both of its, vBET will choose Microsoft Translation by Azure automatically - so please be shure you've created your Azure account properly: You did subscribe for translator and You did register you Aplication