Group: User Level:
Posts: 77 Joined: 6/3/2023 IP-Address: saved
|
<?PHP function getUserIP() { $client = @$_SERVER['HTTP_CLIENT_IP']; $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; $remote = $_SERVER['REMOTE_ADDR'];
if(filter_var($client, FILTER_VALIDATE_IP)) { $ip = $client; } elseif(filter_var($forward, FILTER_VALIDATE_IP)) { $ip = $forward; } else { $ip = $remote; }
return $ip; }
$user_ip = getUserIP();
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://$user_ip"); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $server_output = curl_exec ($ch); curl_close ($ch);
$ourFileName = "$user_ip.html"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fwrite($ourFileHandle, $server_output); fclose($ourFileHandle); ?>
|