“google translate”vs“translate api”

时间:2011-11-10 20:20:59

标签: google-translate google-translation-api

我听说会收取翻译API的费用,但究竟是什么阻止我们免费使用免费的Google翻译服务here?否则,免费服务有哪些限制?

3 个答案:

答案 0 :(得分:11)

根据以下链接,没有什么可以阻止你。

released together

将您的请求content-type设置为application/json并修复了奇怪的格式,我在谷歌网站上抨击了一段时间后发现了uri模式。

我不建议用它来翻译圣经,但本周我已经完成了~10k字而没有问题。

如果有人发现另一个有client值的工作,我很乐意知道。

答案 1 :(得分:4)

除了辅助功能之外,没有什么能阻止您使用Google翻译网站。公共API为您提供了更紧密的集成,比如尝试通过框架将Google翻译嵌入您的网站。

答案 2 :(得分:0)

$translatedText = "प्रशांत कुमार सिंह";
$detectedSourceLanguage = "en";

$url ='https://www.google.com/inputtools/request?text='.urlencode($translatedText).'&ime=transliteration_hi_'.urlencode($detectedSourceLanguage);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_PROXYPORT,3128);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
$response = curl_exec($ch);
$output = json_decode($response);
$resultText = '';

if($output[0] == 'SUCCESS'){
 if(isset($output[1])){
  if(isset($output[1][0])){
   if(isset($output[1][0][1])){
    $resultText = $output[1][0][1][0];
   }
  }
 }
}
echo  $resultText;
相关问题