Download Video
function handle_video_download() {
if ($_SERVER[‘REQUEST_METHOD’] === ‘POST’ && !empty($_POST[‘videoUrl’])) {
$video_url = sanitize_text_field($_POST[‘videoUrl’]);
$api_url = “https://api.example.com/download?url=” . urlencode($video_url);
// Redirect to the download link
wp_redirect($api_url);
exit;
}
}
add_action(‘init’, ‘handle_video_download’);
.video-download-box {
width: 300px;
margin: 20px auto;
padding: 15px;
background-color: #f5f5f5;
border: 1px solid #ddd;
border-radius: 5px;
}
.video-download-box input[type=”text”] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 3px;
}
.video-download-box input[type=”submit”] {
padding: 10px 15px;
background-color: #28a745;
color: #fff;
border: none;
border-radius: 3px;
cursor: pointer;
}
.video-download-box input[type=”submit”]:hover {
background-color: #218838;
}