...

View Full Version : i cant see chinese and korean letters



mnask79
08-16-2007, 09:07 PM
hi every body ... i have wrote php script to translate english statement to chinese by use altavista translator .. the problem is i cant see the korean or chinese words :confused:

the script is

header("Content-Type: text/html;charset=utf-8");
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'http://babelfish.altavista.com/tr');
$headers['Content-Type'] = 'text/html;charset=UTF-8';


$postArr['doit'] = 'done' ;
$postArr['intl'] = '1' ;
$postArr['tt'] = 'urltext' ;
$postArr['lp'] = 'en_ko'; //
$postArr['trtext'] = "how are you everybody";
$postArr['btnTrTxt'] = "Translate";


curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $postArr);

curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER ,1);
curl_setopt($curl_handle, CURLOPT_HEADER, 1);
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, $headers);

$x = curl_exec($curl_handle);

curl_close($curl_handle);

$x = html2txt($x);

$strStart = strpos($x,'*')+1;
$strEnd = strpos($x,'Translate again') ;
$strLength = $strEnd-$strStart ;
$outputvalue = substr($x ,$strStart,$strLength);
echo $outputvalue; /// this value ????? or nothing when translate to korean



function html2txt($document){
$search = array('@<script[^>]*?>.*?</script>@si', // Strip out javascript
'@<style[^>]*?>.*?</style>@siU', // Strip style tags properly
'@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags
'@<![\s\S]*?--[ \t\n\r]*>@' // Strip multi-line comments including CDATA
);
$text = preg_replace($search, '', $document);
return $text;
}


i hope you can help please

mnask79
08-17-2007, 04:01 PM
what a stromg forum !!! .. nobody wana help me !!!!
anyway thak you all :(



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum