Bing Çeviri API

<?php 
header('Content-Type: text/html; charset=utf-8');
function bingapicek(){
$url='http://www.bing.com/translator/dynamic/js/LandingPage.js?loc=tr&phenabled=&rttenabled=';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_URL, $url);
$html = curl_exec($ch);
preg_match_all("/appId:\"(.*?)\"/si",$html,$sonuc);
return ($sonuc[1][0]);
}
function bingcevir($text,$from,$to){
$url='http://api.microsofttranslator.com/v2/ajax.svc/TranslateArray2?';
$url.='appId=%22'.bingapicek().'%22&texts=%5B%22';
$url.=rawurlencode($text);
$url.='%22%5D&from=%22';
$url.=$from;
$url.='%22&to=%22';
$url.=$to;
$url.='%22&options=%7B%7D&oncomplete=onComplete_1&onerror=onError_1&_=1412367301272';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);  
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_URL, $url);
$html = curl_exec($ch);
curl_close($ch);
preg_match_all("#\"(.*?)\"#si",$html,$s); 
return str_replace('"',"",$s[0][6]);
}
?>
<form action="" method="post">
<input type="" name="text"/>
<input type="submit" value="Türkçeye Çevir"/>
</form>
<?php
if(isset($_POST["text"])){
echo bingcevir($_POST["text"],"","tr");
}
?>