i can't get real ip address of my localhost in php? i received this kind of thing ::1 when i execute code please help me

0 Rizwan Abid · July 2, 2014
//i use this code for get ip address
<?php
echo $_SERVER['REMOTE_ADDR'];
?>

Post a Reply

Replies

Oldest  Newest  Rating
0 Tom Delodder · September 2, 2014
Try replacing 'localhost' with '127.0.0.1' in your browser to run your code. 

This solved it for me.
+1 Shamal Sandeep · August 8, 2014
You're getting ::1 as your ip because You computer in configured with ipv6. Simply 127.0.0.1 is the ipv4 address. This means that ::1 is the ipv6 equivalent for 127.0.0.1
0 Rizwan Abid · July 4, 2014
<?php
echo $_SERVER['REMOTE_ADDR'];


?>


this code is use by me for the get ip address
0 Rizwan Abid · July 2, 2014
Linguist Llama thanks 
actual problem is i want to get my local computer ip which is 127.0.0.1 but i see this  ::1
please tell me what is the method to get 127.0.0.1 this ip address?
0 JOhaL jaTT · July 2, 2014
<?php
echo $_SERVER['REMOTE_ADDR'];


?>
  • 1

PHP

107,229 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators