// --- INTELLIGENT KEYWORD CLEANING --- $ur = $_SERVER['REQUEST_URI']; // 1. Remove common "fluff" words that break Amazon searches $fluff = ["review", "pros", "cons", "best", "vs", "versus", "2025", "2026", "cheap", "quality"]; $clean_ur = str_ireplace($fluff, " ", $ur); // 2. Remove symbols and URL artifacts $clean_ur = str_replace(["/", "-", ".php", "%20", "+", "_"], " ", $clean_ur); // 3. Take only the first 3-4 words (this captures the Brand + Model) $words = explode(' ', trim($clean_ur)); $words = array_filter($words); // remove empty spaces $keyword = implode(' ', array_slice($words, 0, 4)); // Now $keyword will be "lolykitch 6qt tri ply" instead of the whole sentence.