-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpublic_web.php
More file actions
27 lines (25 loc) · 712 Bytes
/
Copy pathpublic_web.php
File metadata and controls
27 lines (25 loc) · 712 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
<!DOCTYPE html>
<!-- Public web example, more secure than local.php -->
<html>
<head>
<title>Python Script Interface</title>
</head>
<body>
<form action="index.php" method="post">
<label for="prompt">Prompt:</label>
<input type="text" id="prompt" name="prompt" required>
<br>
<button type="submit" name="submit">Submit</button>
</form>
<?php
if (isset($_POST['submit'])) {
// Python-Skript aufrufen und Ergebnis abrufen
$prompt = $_POST['prompt'];
$result = shell_exec("python3 your_script.py \"$prompt\"");
// Ergebnis anzeigen
echo "<h3>Result:</h3>";
echo "<pre>$result</pre>";
}
?>
</body>
</html>