Fix:
you need to use ipinfo.io not ipstack.com
I’ve changed this code on script.js
var IPINFO_TOKEN = ‘<YOUR_API_KEY>’;
var intl_tel_default_setting={
initialCountry: “auto”,
utilsScript: wpcf7_utils_url,
geoIpLookup: function(callback) {
jQuery.get(‘//ipinfo.io?token=’+IPINFO_TOKEN, function() {}, “jsonp”).always(function(resp) {
var countryCode = (resp && resp.country) ? resp.country : “”;
callback(countryCode);
});
// jQuery.get(‘//freegeoip.net/json’, function() {}, “jsonp”).always(function(resp) {
// var countryCode = (resp && resp.country_code) ? resp.country_code : “”;
// callback(countryCode);
// });
}
};
This looks like a good fix but I’m getting some errors on the js when I try to minify it. Have you got an update to the code?
SK
(@sooskriszta)
Looks like you are still using ipinfo, instead of ipstack.
Also, IPStack’s JSON callback is like this:
http://api.ipstack.com/IP_ADDRESS
? access_key = YOUR_ACCESS_KEY
& callback = MY_FUNCTION
Also, folks should note that the free API provides a response on http. For https, IPStack requires premium subscription.
In both /script.js and /script.min.js, just search and replace //freegeoip.net/json with //reallyfreegeoip.org/json.
No key is needed. After https://freegeoip.net was deprecated, https://reallyfreegeoip.org was launch to replace it. It is fully compatible with the same parameters.
They also have a neat bulk IP lookup tool too if your looking to parse your logs’ IP addresses.
-
This reply was modified 7 years, 4 months ago by
joserolles.