از کاربر ورودی را با جاوا اسکریپت بگیرید سپس پست کنید به صفحه a.php با کد های زیر که translate میکند :
کد:<?php $apiKey = '<paste your API key here>'; $text = 'Hello world!'; $url = 'https://www.googleapis.com/language/translate/v2?key=' . $apiKey . '&q=' . rawurlencode($text) . '&source=en&target=fr'; $handle = curl_init($url); curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($handle); $responseDecoded = json_decode($response, true); curl_close($handle); echo 'Source: ' . $text . '<br>'; echo 'Translation: ' . $responseDecoded['data']['translations'][0]['translatedText']; ?>





پاسخ با نقل قول