Itranslate4 Çeviri API

Not:Sunucu kaynaklı uzun kelimelerde çeviri süresi uzamaktadır.

<?php
$basla=microtime(); 
header('Content-Type: text/html; charset=utf-8');
?><pre>
<form action="" method="post"><textarea name="text" maxlenght="500" cols="75" rows="5"></textarea><br>
<input type="submit" value="Çevir"/></form>
<?php
function it4cevir($text,$from,$to){
 $data='{"src":"'.$from.'","trg":"'.$to.'","dat":"'.$text.'","dom":"","uid":"3ba5c1b2494446deac64500ff977171f","type":"text","trs_open_count":6,"trs_max_count":100}';
 $url="http://itranslate4.eu/csa?func=translate&origin=text&data=".rawurlencode($data);
 $ch = curl_init($url);
 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_FOLLOWLOCATION, 1);
 curl_setopt($ch, CURLOPT_HEADER, 0);
 curl_setopt($ch, CURLOPT_URL, $url);
 $html = curl_exec($ch);
 curl_close($ch);
 $e=json_decode($html);
 $data='{"tid":"'.$e->tid.'"}';
 $r="1111111";
 $a="9999999";
 $t="111111111";
 $b="999999999";
 $url="http://itranslate4.eu/csa?func=translate_poll&rand=0.".rand($r,$a).rand($t,$b)."&data=".rawurlencode($data);
 $ch = curl_init($url);
 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_FOLLOWLOCATION, 1);
 curl_setopt($ch, CURLOPT_HEADER, 0);
 curl_setopt($ch, CURLOPT_URL, $url);
 $html = curl_exec($ch);
 curl_close($ch);
 $a=(json_decode($html));
 if(isset($a->dat[0]->sgms[0])){
 return ($a->dat[0]->sgms[0]->units[0]->text);
 }else{
 return it4cevir($text);
 }
}
if(isset($_POST["text"])){
echo it4cevir($_POST["text"],"en","tr");//ingilizceden türkçeye çeviriyoruz
}
$son=microtime(); 
echo "<p>".abs($basla-$son)." saniyede yüklendi";

 

Sizin Değerli Görüşlerinize İhtiyacımız Var.