gpt4 book ai didi

PHP如何检查openload视频是否存在?

转载 作者:行者123 更新时间:2023-11-29 09:56:00 27 4
gpt4 key购买 nike

我需要一些东西来检查 openload 视频是否存在,某些视频有时会被 DMCA 报告删除,我只需要显示自己无效的链接。

只是我想要的草图

$result = mysqli_query($db, "SELECT videos FROM table");
while($row=mysqli_fetch_assoc($result) {

$embedUrl = $row["videos"];

//so i wanna show only not working url's
if($embedUrl == false)
echo $embedUrl;
}

这是无效链接的示例 here

最佳答案

试试这个。输出:如果视频不存在,则“视频不可用”。

请参阅评论以获取逐步说明。

<?php

// Your Openload URL
$url = 'https://openload.co/embed/UgmaOAo1wlg/Horrible.Bosses.2.2014.720p.BluRay.x264.YIFY.mp4';

// Initialize cURL library.
if (($curl = curl_init()) === FALSE)
{
$errno = curl_errno();
throw new RuntimeException("curl_init() ($errno): " . curl_strerror($errno));
}

// Tell cURL which URL to operate on. GET is the default method.
curl_setopt($curl, CURLOPT_URL, $url);

// Optionally specify a path to a certificate store in PEM format.
// curl_setopt($curl, CURLOPT_CAINFO, __DIR__ . '/cacert.pem');
// Given Openload URL is requested over https. Allow for some sanity checking.
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, TRUE);
// Set this to the latest SSL standard supported by PHP at the time of this answer.
curl_setopt($curl, CURLOPT_SSLVERSION, 6);

// Return response, so we can inspect its contents.
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
// Openload returns HTTP code 200 if a video wasn't found. Any code >= 400 indicates a different problem.
curl_setopt($curl, CURLOPT_FAILONERROR, TRUE);
// Allow for server-side redirects.
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE);
// Don't include header in response.
curl_setopt($curl, CURLOPT_HEADER, FALSE);

if (($response = curl_exec($curl)) === FALSE)
throw new RuntimeException("curl_exec() failed for $url: " . curl_error($curl));

// Perform a case-insensitive search for a token that is specific to the 'video not found' page.
if (stripos($response, '<img class="image-blocked" src="/assets/img/blocked.png" alt="blocked">') !== FALSE)
echo 'Video unavailable';

关于PHP如何检查openload视频是否存在?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53836532/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com