/**
* GOOGLE翻译 英汉
*
* @param string $text 翻译句
* @return unknown
*/
function googleTran($text){
if(empty($text)) return "";
sleep(1);//反间碟
$wf=@file_get_contents('http://translate.google.cn/translate_t?sl=en&tl=zh-CN&text='.urlencode($text).'#');
if (false===$wf||empty($wf)){
return false;
}
//截取相关信息
$return = "";
$wf=strip_tags($wf,"
");
$star=strpos($wf,"
");
if(false===$star){
return false;
}
$end=strpos($wf,"
");
if(false===$end){
return false;
}
$return = strip_tags(substr($wf,$star,$end-$star));
return iconv("GB2312","UTF-8",trim($return));
}
?>
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn