พอดีมีพนักงานเข้ามาใหม่ เป็นชาวญี่ปุ่นสองคน เกิดอยากพูดภาษาญี่ปุ่นมั้ง เลยทำ Dictionary ขึ้นมาง่ายๆ แค่ยิงไปถามที่ http://www.lingvozone.com ไว้มีเวลา จะยิงไปที่ google language tool มั่ง
ทิ้ง code ใว้ให้ สำหรับมือใหม่ หวังว่าจะมีประโยชน์มั่ง
<html>
<head>
<title>simple en-jp</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>
<form method="GEt">
<input type="text" name="word"/>
<input type="submit"/>
</form>
<?php
$word = urlencode($_REQUEST['word']);
if ($word != ""){
$contents
= stream_get_contents(fopen("http://www.lingvozone.com/dictionary?action=translation_ajax&do=dictionary&language_id_from=23&language_id_to=35&word=$word&t.x=0&t.y=0",
"r"));
preg_match_all('/<a target="_parent"
class="black".*>(.*?)<\/a>/mi', $contents, $matches,
PREG_OFFSET_CAPTURE);
foreach($matches[1] as $value){
echo $value[0] . ", \n";
}
}
?>
</body>
</html>
เจอบ้างไม่เจอบ้าง ก็ว่ากันไป ขำขำ
ไม่มีความเห็น