Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
- <html lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Swath Web</title>
- <meta name="generator" content="TextMate http://macromates.com/">
- <meta name="author" content="Vee Satayamas">
- </head>
- <body>
- <form method="post">
- <textarea name="input_text" cols="80" rows="10"></textarea>
- <input type="submit" value="submit">
- </form>
- <?php
- function swath($input_text)
- {
- $input_filename= tempnam("/tmp", "swath_");
- $output_filename= tempnam("/tmp", "swath_");
- $input_text_tis620 = iconv("UTF-8", "TIS-620", $input_text);
- file_put_contents($input_filename, $input_text_tis620);
- system("/usr/bin/swath < $input_filename > $output_filename");
- $raw = file_get_contents($output_filename);
- $raw_utf8 = iconv("TIS-620", "UTF-8", $raw);
- unlink($input_filename);
- unlink($output_filename);
- return preg_split('/\|/', $raw_utf8);
- }
- if($_REQUEST['input_text']) {
- $output = swath($_REQUEST['input_text']);
- print implode(" ", $output);
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement