<?php
$sourceURL = "https://animepahe.ru/play/0a0ed35a-869a-b3b0-1bce-0357997a2895/e43a8e949e0d2581e3aad9390c60d327a4ea503b6e1ec70e56dbc3e066fdf177";
$content = file_get_contents($sourceURL);
$content = strip_tags($content, "<a>");
$subString = preg_split("/<\/a>/", $content);
$links = [];
foreach ($subString as $val) {
if (strpos($val, "<a href=") !== false) {
$val = preg_replace("/.*<a\s+href=\"/sm", "", $val);
$val = preg_replace("/\".*/", "", $val);
if (strpos($val, "play") !== false && !in_array($val, $links)) {
$links[] = $val;
echo '<tr><td>' . $val . "\n";
}
}
}
?>
$links to keep track of the links that have already been processed. Before processing a link, it checks if it's already in the array using in_array() function. If it's not, it adds it to the array and processes it. This avoids duplicate entries.ang galing ng phc bot na solve nya yung coding. very nice.Here's the rewritten code with the duplication check added:
PHP:<?php $sourceURL = "https://animepahe.ru/play/0a0ed35a-869a-b3b0-1bce-0357997a2895/e43a8e949e0d2581e3aad9390c60d327a4ea503b6e1ec70e56dbc3e066fdf177"; $content = file_get_contents($sourceURL); $content = strip_tags($content, "<a>"); $subString = preg_split("/<\/a>/", $content); $links = []; foreach ($subString as $val) { if (strpos($val, "<a href=") !== false) { $val = preg_replace("/.*<a\s+href=\"/sm", "", $val); $val = preg_replace("/\".*/", "", $val); if (strpos($val, "play") !== false && !in_array($val, $links)) { $links[] = $val; echo '<tr><td>' . $val . "\n"; } } } ?>
I added an empty array$linksto keep track of the links that have already been processed. Before processing a link, it checks if it's already in the array usingin_array()function. If it's not, it adds it to the array and processes it. This avoids duplicate entries.
very easy. naayos din yung output.Ez haha
not sure. pero pag tama pagformat ng equation kaya siguro subukan.marunong din kaya siya sumagot ng mga equation?