Kohana accessing client ip
Asked Answered
R

1

5

I am using kohana 3.2, and i would like to acces client ip from request class, in documentation i can see public static string $client_ip which should contain client ip, now if i try to access it i like so:

Request::$client_ip;

I get: string(3) "::1" it makes no sense at all, what am i doing wrong, or maybe it's impossible to access it?

Reparative answered 19/7, 2012 at 16:26 Comment(5)
Why doesn't it make sense? You access your script locally, your IPv6 address is ::1Gotthard
@Gotthard oh my god how could i forget about that...Reparative
How to get client ip address in kohana 2.3.4? can any one tell me the code?Squeteague
@Squeteague I'm not sure about 2.3.4 but you can always just use $_SERVER['REMOTE_ADDR']Reparative
@Reparative Thank you, i got the solution. In Kohana 2.3.4 we use $this->input->ip_address();Squeteague
G
8

You access your script locally, your IPv6 address is ::1

Gotthard answered 19/7, 2012 at 18:30 Comment(1)
+1 for the ipv6. Good to bring this up as most new dev's wont know wtf ::1 is.Odysseus

© 2022 - 2024 — McMap. All rights reserved.