Exception or error:
I am trying to make my python code run on website. In my python code, I need to input one image and one video url, like this:
import cv2
img = "1.jpg"
cap = cv2.VideoCapture("https://www.youtube.com/watch?v=-OUhbw-XsTg")
So I write a HTML code so that I can input image and video url:
<html>
<body>
<form action="upload1.php" method="post" enctype="multipart/form-data">
<input type="file" name="file" id="file" /><br/><br/>
Video URLs:<input type="url" name="url" id="myURL"><br/><br/>
<button name = "Analyze" type="submit"> Analyze </button>
</form>
</body>
</html>
I want that when I input an image and url, after clicking Analyze it can return the image and url path to python and run the code. I only know how to call python script but don’t know how to get and return value to python.
<?php
if (isset($_POST['Analyze'])){
exec("python code.py",$output);
var_dump($output);
}
?>
Can anyone help my how to get the path from HTML and return to python with PHP? Thank you.
How to solve: