1. function Translate($word){
  2. $word = urlencode($word);
  3. $input = 'en';
  4. $output = 'de';
  5. $url = "http://translate.google.com/translate_a/t?client=t&text=$word&hl=en&sl=$input&tl=$output&multires=1&otf=2&pc=1&ssel=0&tsel=0&sc=1";
  6. $translated = file_get_contents($url);
  7. // hacky way to fetch the first word
  8. $translated = explode('"',$translated);
  9. return $translated[1];
  10. }
Comments powered by Disqus