Using PHP / Google Translate foreign language to english

Here is the code to utilize Google Translate to translate any text to English for free.
/*
this function translates chinese to english
if you want to use this function, please write your own curl_post_content – it’s just a curl request using post method – i have my own curl_post_content which i can’t publish here.
the data that google returns doesn’t work well with json_decode function, we have to fix it a little bit, see the str_replace function here
*/

function translate_to_english($text)
{
$url=”https://translate.google.com/translate_a/single?client=t&sl=auto&tl=en&hl=en&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&dt=at&ie=UTF-8&oe=UTF-8&otf=2&srcrom=0&ssel=0&tsel=0&source=btn&kc=2&tk=523995|731640″;
$data=array();
$text=strip_tags($text);
$data[“q”]=$text;
$response=curl_post_content($url,$data);
$response=str_replace(“,,”,”,0,”,$response);
$response=str_replace(“,,”,”,0,”,$response);
$response=str_replace(“[,”,”[0,”,$response);
$obj =json_decode($response,true ); //true converts stdClass to associative array.
$result=””;
foreach($obj[0] as $v)
{
if($v[0]==”0″)
continue;
$result.=$v[0].”\r\n”;
}
i
return trim($result);
}