スポンサーサイト
- -
- -
- -
- スポンサードリンク
2015.07.13 Monday
一定期間更新がないため広告を表示しています
これは翻訳のテストデス。 MicrosoftAPIを使っています。 WordPressの投稿を取得して自動で文章を変換しています。 ちゃんとできているのかな?
-------------------------------------
This is a translation test death. Use MicrosoftAPI. To get WordPress posts, has converted the sentences automatically. And made of it?
define('APPID', 'MyAPPID');
$text = get_the_content(); //ここで投稿の値を突っ込む。
$to = 'en'; //英語に変換
$ch = curl_init('https://api.datamarket.azure.com/Bing/MicrosoftTranslator/v1/Translate?Text=%27'.urlencode($text).'%27&To=%27'.$to.'%27');
curl_setopt($ch, CURLOPT_USERPWD, APPID.':'.APPID);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
$result = explode('<d:Text m:type="Edm.String">', $result);
$result = explode('</d:Text>', $result[1]);
$result = $result[0];
echo $text."<br>-------------------------------------<br> ".$result;