[ 'timeout' => $timeout, 'user_agent' => $_SERVER['HTTP_USER_AGENT'] ?? 'Mozilla/5.0', 'ignore_errors' => true ] ]); return @file_get_contents($url, false, $context); } // Utility: format brand+longtail, hasil: HEHE555 APP function formatBrandLongtail($brand, $longtail = '') { if ($longtail !== '') { return strtoupper(trim($brand . ' ' . str_replace('-', ' ', $longtail))); } return strtoupper(trim($brand)); } // --------------- RENDER MASSAL FUNCTION --------------- function render_massal_page() { global $brands, $brandLongtail, $images, $title, $desc, $paragraf; $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https" : "http"; $host = $_SERVER['HTTP_HOST']; $scriptDir = rtrim(dirname($_SERVER['SCRIPT_NAME']), '\\/'); $baseUrl = $protocol . "://" . $host . ($scriptDir && $scriptDir != '/' ? $scriptDir : '') . "/"; $slug = ''; if (isset($_GET) && count($_GET)) { $slug = createSlug(array_keys($_GET)[0]); } $foundBrand = ''; $foundLongtail = ''; $brandIndex = null; $longtailIndex = null; foreach ($brands as $i => $brand) { $slugBrand = createSlug($brand); if ($slug === $slugBrand) { $foundBrand = $slugBrand; $brandIndex = $i; break; } foreach ($brandLongtail as $j => $longtail) { $slugLongtail = createSlug($longtail); if ($slug === $slugBrand.'-'.$slugLongtail) { $foundBrand = $slugBrand; $foundLongtail = $slugLongtail; $brandIndex = $i; $longtailIndex = $j; break 2; } } } $canonicalUrl = $baseUrl; if ($foundBrand && $foundLongtail !== '') { $canonicalUrl .= '?' . $foundBrand . '-' . $foundLongtail; } elseif ($foundBrand) { $canonicalUrl .= '?' . $foundBrand; } // Ambil template dari remote/lokal $template = @file_get_contents('https://pbn-ph.website/data/gallery/template.html'); if ($template === false) die('Template HTML not found!'); // ==== Penentuan Brand Name (brand + longtail) ==== if ($foundBrand && $foundLongtail !== '') { $longtailCount = count($brandLongtail) ?: 1; $comboIndex = ($brandIndex * $longtailCount) + $longtailIndex; // Format nama brand: HEHE555 APP, CK44 LOGIN, dst. $brandOriName = isset($brands[$brandIndex]) ? $brands[$brandIndex] : ''; $longtailText = ''; if (isset($brandLongtail[$longtailIndex])) { $longtailText = $brandLongtail[$longtailIndex]; } $brandName = formatBrandLongtail($brandOriName, $longtailText); $titleText = getLooped($title, $comboIndex); $descContent = applyBrandPlaceholder(getLooped($desc, $comboIndex), $brandName); $paragrafContent = applyBrandPlaceholder(getLooped($paragraf, $comboIndex), $brandName); $imageUrl = getLooped($images, $comboIndex); $body = '⇦ Back to ' . htmlspecialchars($brandOriName) . ''; $body .= '
Description: ' . htmlspecialchars($descContent) . '
'; $body .= 'Description: ' . htmlspecialchars($descContent) . '
'; $body .= '