Viewing 1 replies (of 1 total)
  • Thread Starter Moddinu

    (@moddinu)

    After further investigation I found that the the problem was with the service used to get the users ip so I change the code as follows:

    $url = 'https://www.geoplugin.net/xml.gp?ip='.$ip;
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $cdata = curl_exec($ch);
    curl_close($ch);
    $carr = simplexml_load_string($cdata);
    
    $return = $countries["{$carr->geoplugin_countryCode}"];
    return $return;

    Note: If you are using the plugin on a localhost machine the ip would be 127.0.0.1 therefore the service will return a 404 error. so you may want to add an if statement to set a default county code if the ip is 127.0.0.1.

Viewing 1 replies (of 1 total)
  • The topic ‘Front End Hangs for 30 Seconds’ is closed to new replies.