- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpPythonPost.php
More file actions
Latest commit
30 lines (27 loc) · 594 Bytes
/
Copy pathphpPythonPost.php
File metadata and controls
30 lines (27 loc) · 594 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?PHP
require_once("class.phpPythonPipe.php");
$path_to_python = "/home/filipi/anaconda3/bin/python";
if (!isset($_GET['pythonCode'])){
$pythonCode = "import sys\n";
$pythonCode .= "print(\"Hello\")\n";
}
else
$pythonCode = $_GET['pythonCode'];
?>
<html>
<body>
<form method="POST">
<textarea name="pythonCode">
<?phpecho$pythonCode; ?>
</textarea>
<input type="submit" value="submit">
</form>
<?php
$python = newphpPythonPipe();
$python->kernelPath = $path_to_python;
$python->code = $pythonCode;
$python->exec();
$python->print();
?>
</body>
</html>