function worldlingocevir($text,$from,$to){$url='http://www.worldlingo.com/S000.1/api';$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_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS,"wl_data=".rawurlencode($text)."&"."wl_srclang=".$from."&"."wl_trglang=".$to."&"."wl_srcenc=UTF-8&"."wl_trgenc=UTF-8&"."wl_password=secret&"."wl_mimetype=text/plain&"."wl_opt=1&"."wl_errorstyle=1&"."wl_dictno=&"."Submit=Submit");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);return $html;}
Kullanımı
echo worldlingocevir("what is your name","en","tr");