使用php 检测 http3913424161dbiptvsnchinamobilecomPLTV88888890224322122$idindexm3u8; $id为从0000到9999 是否正常访问
可以使用curl函数来检测URL是否正常访问。以下是一个简单的示例代码:
<?php
for ($i = 0; $i < 10000; $i++) {
$id = sprintf("%04d", $i);
$url = 'http://39.134.24.161/dbiptv.sn.chinamobile.com/PLTV/88888890/224/322122' . $id . '/index.m3u8';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($http_code == 200) {
echo $url . " is accessible.\n";
} else {
echo $url . " is not accessible.\n";
}
}
?>
这个代码将从0000到9999遍历ID,并使用curl函数检查每个URL的访问情况。如果HTTP响应代码为200,则表示该URL可访问,否则表示不可访问
原文地址: https://www.cveoy.top/t/topic/fp4n 著作权归作者所有。请勿转载和采集!