I was trying to read Google Translate data from Linux terminal cURL:
curl -i --user-agent "" -d "sl=en" -d "tl=sk" --data-urlencode "text=hi" https://translate.google.com
It returned whole page, where I could see Translate result. Result was in one HTML element. But when I tried it with PHP's cURL, it doesn't outputed the same HTML and I wasn't able to find Translate result.
$data = [
"sl" => "en",
"tl" => "sk",
"text" => urlencode("hi");
];
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, "https://translate.google.com");
curl_setopt($ch,CURLOPT_POST, count($data));
curl_setopt($ch,CURLOPT_POSTFIELDS, $data);
curl_setopt($ch,CURLOPT_HEADER, true);
curl_setopt($ch,CURLOPT_USERAGENT, "");
curl_exec($ch);
Thank you to help me, how can I return in PHP the same result as in Linux cURL.