• Resolved talgerafi

    (@talgerafi)


    Hi,
    seems you need to change the API Endpoint to ipstack.com
    Plugin doesn’t work anymore so it doesn’t pull the ip and can’t locate the country.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter talgerafi

    (@talgerafi)

    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?

    OC2PS

    (@sooskriszta)

    Looks like you are still using ipinfo, instead of ipstack.

    Also, IPStack’s JSON callback is like this:

    https://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 5 years, 10 months ago by joserolles.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘freegeoip.net moved to ipstack.com’ is closed to new replies.