Code share to Everyone
Copy CodeThe code is as follows:
/**
* Google Translate English-Chinese
*
* @param string $text translation sentences
* @return Unknown
*/
function Googletran ($text) {
if (empty ($text)) return "";
Sleep (1);//Spyalectical Disc
$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;
}
Intercept related information
$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));
}
?>
http://www.bkjia.com/PHPjc/320135.html www.bkjia.com true http://www.bkjia.com/PHPjc/320135.html techarticle code share to everyone copy code code as follows:?/** * Google Translate English-Chinese * * @param string $text translation sentence * @return Unknown */function Googletran ($text) {if (Empty ($text)) Retu ...