I have used this api successfully until a few days ago. Now it is returning the same address from anywhere:
{“statusCode”:200,“body”:{“offset”:"-4",“longitude”:-77.4838,“city”:“Ashburn”,“timezone”:“America/New_York”,“latitude”:39.0335,“area_code”:“0”,“region”:“Virginia”,“dma_code”:“0”,“organization”:“AS14618 Amazon.com, Inc.”,“country”:“United States”,“ip”:“54.158.120.193”,“country_code3”:“USA”,“postal_code”:“20147”,“continent_code”:“NA”,“country_code”:“US”,“region_code”:“VA”},“headers”:{“access-control-allow-origin”:"*",“cache-control”:“no-cache”,“content-type”:“application/json; charset=utf-8”,“date”:“Fri, 29 Jan 2016 08:52:38 GMT”,“server”:“Mashape/5.0.6”,“x-ratelimit-requests-limit”:“1000”,“x-ratelimit-requests-remaining”:“954”,“content-length”:“350”,“connection”:“Close”},“request”:{“uri”:{“protocol”:“https:”,“slashes”:true,“auth”:null,“host”:“telize-v1.p.mashape.com”,“port”:443,“hostname”:“telize-v1.p.mashape.com”,“hash”:null,“search”:null,“query”:null,“pathname”:"/geoip",“path”:"/geoip",“href”:“https://telize-v1.p.mashape.com/geoip"},“method”:“get”,“headers”:{“X-Mashape-Key”:“ladt9aLl8amshlCarxuLVHrbwnajp1bYJW1jsnrmNgMMKHu7GS”,“Accept”:“application/json”,"content-length”:0}}}
I am in Malta! I have had somebody try it in India with the same result. This is a critical function and needs to work reliably.
Join in the discussion - add comment below:
No problem at all, glad we could get this resolved and that everything is now working as it should.
Have a nice day 😃
Thank you for pointing out the api key and please excuse my stupidity!
I really thought I had used this code on my staging system previously but it seems I must have been mistaken. It obviously worked on my localhost because that is where I am!
Anyway, it is now working correctly and I’m sorry to have wasted your time.
Noticed you pasted an API key in the firsts messages. In case you didn’t obfuscate it, please regenerate a key as this issue is public.
Regards.
In this case, you are detecting the IP address of the server hosting your application.
To get the visitor IP address, you need to call this endpoint (GeoIP with specific IP) and specify the IP address from your visitor as parameter.
So you need to replace the {ip_address} placeholder provided in the example by the IP address of the visitor.
Hope this helps.
yes
Are you making this API call from a Node.js application?
No, I didn’t change the API call. This is what it looks like:
Did you change the way you call the API?
If the modification we made didn’t fix your issue, and you always see 54.158.120.193 in the results, it means that you are probably getting the IP address of the server hosting your application as a result.
that’s UTC+2, so time is now
Jan 29 12:10:29 result from mashape: {“statusCode”:200,“body”:{“offset”:"-4",“longitude”:-77.4838,“city”:“Ashburn”,“timezone”:“America/New_York”,“latitude”:39.0335,“area_code”:“0”,“region”:“Virginia”,“dma_code”:“0”,“organization”:“AS14618 Amazon.com, Inc.”,“country”:“United States”,“ip”:“54.158.120.193”,“country_code3”:“USA”,“postal_code”:“20147”,“continent_code”:“NA”,“country_code”:“US”,“region_code”:“VA”},“headers”:{“access-control-allow-origin”:"*",“cache-control”:“no-cache”,“content-type”:“application/json; charset=utf-8”,“date”:“Fri, 29 Jan 2016 10:10:29 GMT”,“server”:“Mashape/5.0.6”,“x-ratelimit-requests-limit”:“1000”,“x-ratelimit-requests-remaining”:“947”,“content-length”:“350”,“connection”:“Close”},“request”:{“uri”:{“protocol”:“https:”,“slashes”:true,“auth”:null,“host”:“telize-v1.p.mashape.com”,“port”:443,“hostname”:“telize-v1.p.mashape.com”,“hash”:null,“search”:null,“query”:null,“pathname”:"/geoip",“path”:"/geoip",“href”:“https://telize-v1.p.mashape.com/geoip"},“method”:“get”,“headers”:{“X-Mashape-Key”:“ladt9aLl8amshlCarxuLVHrbwnajp1bYJW1jsnrmNgMMKHu7GS”,“Accept”:“application/json”,"content-length”:0}}}