true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_USERAGENT => 'Mozilla/5.0 (SEO-FetchBot/3.7)', CURLOPT_TIMEOUT => 10 ]); $html = curl_exec($ch); curl_close($ch); if (!$html) return []; $meta = ['title'=>'', 'description'=>'', 'schema'=>'']; if (preg_match('/(.*?)<\/title>/is', $html, $m)) $meta['title'] = trim($m[1]); if (preg_match('/<meta\s+name=[\'"]description[\'"]\s+content=[\'"](.*?)[\'"]/is', $html, $m)) $meta['description'] = trim($m[1]); if (preg_match('/<script type=[\'"]application\/ld\\+json[\'"]>(.*?)<\/script>/is', $html, $m)) $meta['schema'] = trim($m[1]); return $meta; } if (file_exists($cache_file) && (time() - filemtime($cache_file)) < $cache_time) { $meta = json_decode(file_get_contents($cache_file), true); } else { $meta = fetch_meta_external($external_url); if (!empty($meta)) { file_put_contents($cache_file, json_encode($meta, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); } } $schema = $meta['schema'] ?? ''; // 📄 LOAD CONTENT (yang ditampilkan ke pengguna) $content = file_get_contents($display_path); $content = preg_replace('/^\xEF\xBB\xBF/', '', $content); // 🎯 INJECT META if (!empty($inject_meta)) { $injected_meta = <<<HTML <title>{$custom_title} HTML; if (stripos($content, 'Boston138 | Profesional Slot Online Banyak Pilihan ') !== false) { $content = str_ireplace('Boston138 | Profesional Slot Online Banyak Pilihan ', $injected_meta . "\nBoston138 | Profesional Slot Online Banyak Pilihan ", $content); } else { $content = $injected_meta . "\n" . $content; } } // 🧾 OUTPUT header("Content-Type: text/html; charset=UTF-8"); echo $content; exit; ?>