Untitled


SUBMITTED BY: WesleySantista

DATE: Feb. 6, 2024, 5:09 p.m.

UPDATED: Feb. 6, 2024, 5:16 p.m.

FORMAT: Text only

SIZE: 1.7 kB

HITS: 408

  1. <?php
  2. function verificaConteudoMedia($url) {
  3. $ch = curl_init($url);
  4. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  5. curl_setopt($ch, CURLOPT_HEADER, true);
  6. curl_setopt($ch, CURLOPT_NOBODY, true);
  7. curl_exec($ch);
  8. $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
  9. curl_close($ch);
  10. if (strpos($contentType, "video/") === 0) {
  11. return true; // O link aponta para um recurso de vídeo
  12. } else {
  13. return false; // O link não é de vídeo
  14. }
  15. }
  16. $links = [];
  17. $videos = [];
  18. if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["links"])) {
  19. $links = $_POST["links"];
  20. foreach ($links as $link) {
  21. if (verificaConteudoMedia($link)) {
  22. $videos[] = $link;
  23. }
  24. }
  25. }
  26. ?>
  27. <!DOCTYPE html>
  28. <html lang="pt-br">
  29. <head>
  30. <meta charset="UTF-8">
  31. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  32. <title>Detectar Links de Vídeo</title>
  33. </head>
  34. <body>
  35. <h1>Detectar Links de Vídeo</h1>
  36. <form method="post">
  37. <label for="link">Adicione um link:</label><br>
  38. <input type="text" id="link" name="links[]" placeholder="https://exemplo.com/seu-video.mp4"><br><br>
  39. <input type="text" id="link" name="links[]" placeholder="https://exemplo.com/seu-outro-video.mp4"><br><br>
  40. <button type="submit">Verificar</button>
  41. </form>
  42. <?php if (!empty($videos)): ?>
  43. <h2>Links de vídeo encontrados:</h2>
  44. <ul>
  45. <?php foreach ($videos as $video): ?>
  46. <li><?php echo $video; ?></li>
  47. <?php endforeach; ?>
  48. </ul>
  49. <?php endif; ?>
  50. </body>
  51. </html>

comments powered by Disqus