ip-address

How to get user language by ip address using php?

非 Y 不嫁゛ 提交于 2019-12-10 15:05:33
问题 I need to get language of a user who have visiting my website by their IP address using PHP. how can I do it, there is any API to do this, please advise 回答1: Use the GeoIP module as has previously been suggested and then insert this code somewhere in your project: if($country = geoip_country_code_by_name($host)) { switch($country) { case "DJ": case "ER": case "ET": $lang = "aa"; break; case "AE": case "BH": case "DZ": case "EG": case "IQ": case "JO": case "KW": case "LB": case "LY": case "MA"

Port in IPAddress

不问归期 提交于 2019-12-10 12:17:59
问题 I get a string ,representing ip address .It has format ip:port I need to generate IPAddress .Will use for that : public static IPAddress Parse( string ipString ) The IPAddress which I need to get should not contain the data regarding a port. Does parse support that? If not how is it possible to done? 回答1: Well you need to absolutely know whether you are ALWAYS getting a port along with your IP or not. If you are always getting a port then you can always use Jon's code and get rid of the part

Using Local IP address In a Mule ESB application

99封情书 提交于 2019-12-10 11:48:01
问题 I've deployed a Mule ESB application which accept as input a GET HTTP request as follow http://localhost:8088/esb/?id=xxx when replace the localhost with my local IP adress 192.168.1.2 it doesnt work neither on my machin nor on another one from my lan. I've added a rule in the firewall to allow the port 8088 and it doesn't work either. I've disabled my antivirus and the firewall and no result. could someone help? 回答1: I have absolutely no problem using this endpoint configuration: <http

get subnet mask and gateway from IP address

Deadly 提交于 2019-12-10 10:46:15
问题 How can i calculate subnet mask and gateway from an IP address ? Suppose my IP address is 180.12.24.68 Then how can i calculate this IP's subnet mask and gateway? 回答1: You cannot calculate your subnet mask or gateway from just an IP address. You can calculate the range that a potential gateway could be in given an IP address and a netmask. But, the range is basically ((My LAN segment Size) - MyIP). Generally this will be around 253 IP addresses unless you're on a large network. Given a

ValueError: '10.0.0.0/24' does not appear to be an IPv4 or IPv6 network

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 03:39:35
问题 I want to work with IP subnets / IP addresses in Python. I created the Python code using the ipaddress module. When I run the code in the pycharm IDE, it works fine. But when I run on the command prompt by typing python test.py , it shows the following error. ValueError: '10.0.0.0/24' does not appear to be an IPv4 or IPv6 network test.py : import ipaddress srcIp = ipaddress.ip_network("10.0.0.0/24") print(srcIp) 回答1: It seems to work in Python 2.7, if you use a Unicode string. import

Is there a function that can take an ipAddress as string and tell me if its a non-routable IP address?

旧时模样 提交于 2019-12-10 02:56:25
问题 I am trying to determine if an IP address is routable. For example, if I receive 127.0.0.1, I know that this is loopback(ie: localhost). I wasn't able to find a function for this in .NET or any other language, so I have started writing my own which is far from complete. Before I spend lots of time writing this function, does anyone know if a function that determines if a ip address is non-routable exist? I would prefer a .NET solution, but beggers cant be choosers and I'll happily convert any

Android Find the device's ip address when it's hosting a hotspot

跟風遠走 提交于 2019-12-10 02:39:51
问题 I need to find the device's ip address when it's hosting a hotspot. I've used this code so far : //if is using Hotspot for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) { NetworkInterface intf = en.nextElement(); if (intf.getName().contains("wlan")) { for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) { InetAddress inetAddress = enumIpAddr.nextElement(); if (!inetAddress.isLoopbackAddress() &

HttpContext.Current.Request.UserHostAddress is null

ぐ巨炮叔叔 提交于 2019-12-10 02:15:51
问题 In my Dev Machine HttpContext.Current.Request.UserHostAddress is null. Why? how can I turn it on? How can I get list of Ips in case of a proxy client? WCF Service with ASP.net 4 window7. Thanks 回答1: to avoid this problem you can parse the HTTP_X_FORWARDED_FOR for the last entery IP. ip=Request.ServerVariables["HTTP_X_FORWARDED_FOR"] ; if (!string.IsNullOrEmpty(ip)) { string[] ipRange = ip.Split(','); int le = ipRange.Length - 1; string trueIP = ipRange[le]; } else { ip=Request.ServerVariables

Browser IP Address

倖福魔咒の 提交于 2019-12-09 23:41:15
问题 I have 2 apps 1 Ruby (not written by me. I understand nothing of Ruby) and the other ASP.Net The Ruby app determines the users's IP address (I'm told "using first IP found in "HTTP_X_FORWARDED" )and passes a hashed version of it to the ASP.Net app. The ASP.Net app then determines the Client's IP address again (using Request.UserHostAddress) and hashes the value. Then hashes are compared. Generally these hashes are identical ( as you might expect) for all our clients. However we have 1 new

Restricting access to a site using IP address

走远了吗. 提交于 2019-12-09 21:39:45
问题 I would like to know whether there is a way of restricting the users of a site such that they can only access the inner pages of a site if they are within a certain range of IP addresses or a certain network? The current PHP scripts I am getting cant differentiate the real IPs from the Proxies? Thanks 回答1: i wouldn’t restrict on ip addresses. as you said, you can’t know if it’s a proxy. furthermore, ip addresses can be easily spoofed. 回答2: Have you considered using apache .htaccess files for