한국   대만   중국   일본 
??????:????? ??????-???????? - ?????????? ????????? ???? ??? ?? ?????

?????? : ????? ??????-????????

?? ?????????? ????????? ????

??? ????? ???????? ???? ???? ???????? ???????? ???????????? ?????? - ???????? ??? ?? ?? ?? ??? ??????? ?? ???? ???? ? ???? ????? ???? ???.

???? ???? ???????? ??????? ????????? ????????? ?? ????? ????? ???????? ? ?????? ??????? ???? ?? ????? ????? ?????? ?? ???????? ?? ??? ??? ???:

?? ???????? [ ?????? ]

setlocale
(
LC_ALL
,
 "en_US.utf8"
);

header
(
"Content-Type: application/json"
);

header
(
"Access-Control-Allow-Origin: *"
);


$command
 =
 escapeshellcmd
(
"/usr/bin/python2.7 /data/project/YourAccount/pywikipedia/example.py"
);

$args
    =
 escapeshellarg
(
$_GET
[
"FirstArg"
])
 .
 " "
 .
 escapeshellarg
(
$_GET
[
"SecondArg"
]);

echo
 shell_exec
(
$command
 .
 " "
 .
 $args
);

??? ???? ??????? ?? ????????
  1. ?? ????????? ?? ?????? ??? ?? ?? ???? example.py ??? ???????? ?????? ? ?? ????? FirstArg ? SecondArg ?? ?? ????? ?????? ??????.
  2. ?? ???????? ?? ???? ?? public_html ???? ???????? ?? wmflabs.org ???? ????.
  3. ?????? ?? ?? ??? ???? http://tools.wmflabs.org/YourAccount/example.php?FirstArg=test&SecondArg=test ????? ??? ?? ????????? ??? ????? ?? ?? ??? ????? ??????????? ?? ???????? ????? ????.

?? ?????? [ ?????? ]

import
 sys
,
 json

result
 =
 {}

FirstArg
 =
 unicode
(
sys
.
argv
[
1
],
 'UTF-8'
)

SecondArg
 =
 unicode
(
sys
.
argv
[
2
],
 'UTF-8'
)

Text
 =
 run
(
faname
,
 enname
,
 result
)

result
[
'our_text'
]
 =
 Text

print
 json
.
dumps
(
result
)

??? ???? ??????? ?? ??????
  1. ?? ???? ?? ?? ?? ?????? ??? ??? ?? ????? ???????? ???? ??????? ?? ????? ?? ??? ???????? ???? ?? ??? ???? ? ??? ????????? ???? ?? ?? ??? ????.
  2. ????????? FirstArg ? SecondArg ?????????? ????? ?? ?? ?????? ?? ?????? ????? ?? ????? ?????? ?? ????? ??????.
  3. ???? run() ????? ??? ?? ???? ?? ?? ?????? ???????? ?? ??? ????? ??? ??????.
  4. ????? ?? ?????? ?? ???? ???? .json ??? ?? ?? ?????? ???????? ?????? ? ????????? ?? ??? ????? ??????????? ????? ???? ?? ?? ?? ???? ?? ??????? ??? ????.

????? [ ?????? ]