How to get Client IP address
How to get Client IP address
In PHP use the following line. The client ip will be in $ip variable
in ASP.NET use the following in the following order - first check the first option if it returns empty then use the second oneCode:$ip = $_SERVER['REMOTE_ADDR'];
Code:Request.ServerVariables("HTTP_X_FORWARDED_FOR"); Request.ServerVariables("REMOTE_ADDR");
Checking for $_SERVER['HTTP_X_FORWARDED_FOR'] would be good practice in PHP too.
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Bookmarks