+ 1
How can i get ip address location with php?
I want to write it in php and HTML. HTML for to display the IP address. php to get the IP address. css for fun ...
4 Réponses
+ 4
<?php
$http_client_ip =$_SERVER['HTTP_CLIENT_IP'];
$http_x_forwarded_for = $_SERVER['HTTP_X_FORWARDED_FOR'];
$remote_addr= $_SERVER['REMOTE_ADDR'];
if(!empty($http_client_ip)){
$ip_address = $http_client_ip;
}else if(!empty($http_x_forwarded_for)){
$ip_address = $http_x_forwarded_for;
}else {
$ip_address = $remote_addr;
}
echo $ip_address;
?>
+ 3
Flip make one file on your computer save this code in that as php file run there.
for that you'll need wamp or xamp server
or if you have your own website upload this on server to test it
+ 1
People can mask their IP address(es) so, for what it's worth:
https://stackoverflow.com/questions/3003145/how-to-get-the-client-ip-address-in-php
+ 1
I want the IP address to display in the html document...
https://code.sololearn.com/W60imzSqyAKI/?ref=app