01.
<html>
02.
<head>
03.
<title>ThaiCreate.Com PHP & Readfile</title>
04.
</head>
05.
<body>
06.
<?
07.
08.
function
swath(
$input_text
)
09.
{
10.
$input_filename
= tempnam(
"/tmp"
,
"swath_"
);
11.
$output_filename
= tempnam(
"/tmp"
,
"swath_"
);
12.
$input_text_tis620
= iconv(
"UTF-8"
,
"TIS-620"
,
$input_text
);
13.
file_put_contents
(
$input_filename
,
$input_text_tis620
);
14.
system(
"C:/AppServ/www/swathf/swath < $input_filename > $output_filename"
);
15.
$raw
=
file_get_contents
(
$output_filename
);
16.
$raw_utf8
= iconv(
"TIS-620"
,
"UTF-8"
,
$raw
);
17.
unlink(
$input_filename
);
18.
unlink(
$output_filename
);
19.
return
preg_split(
'/\|/'
,
$raw_utf8
);
20.
}
21.
22.
23.
$strFileName
=
"thaicreate.txt"
;
24.
$objFopen
=
fopen
(
$strFileName
,
'r'
);
25.
if
(
$objFopen
) {
26.
while
(!
feof
(
$objFopen
)) {
27.
$file
[] = swath(
fgets
(
$objFopen
, 4096));
28.
}
29.
fclose(
$objFopen
);
30.
}
31.
32.
print_r(
$file
);
33.
34.
?>
35.
</body>
36.
</html>