<![CDATA[ GeoLite Country - My Forums]]> https://forums.modx.com/thread/?thread=49009 <![CDATA[Re: GeoLite Country]]> https://forums.modx.com/thread/49009/geolite-country#dis-post-484855 http://domain.com/file.php

You need to use a file path, not a URL. Paths will be relative to your index.php file, so if you have the geoip.inc file in the web root, it would just be
require_once("geoip.inc");


I don't know if the goip_open function would have the same problem, but if it did then the solution would be the same - file path, not URL.]]>
sottwell Dec 07, 2013, 12:03 AM https://forums.modx.com/thread/49009/geolite-country#dis-post-484855
<![CDATA[Re: GeoLite Country]]> https://forums.modx.com/thread/49009/geolite-country#dis-post-484852
Any luck that you get this work? I'd like to use GeoIP on my site too but not so sure how to start. Please advise.]]>
fab Dec 06, 2013, 10:54 PM https://forums.modx.com/thread/49009/geolite-country#dis-post-484852
<![CDATA[GeoLite Country]]> https://forums.modx.com/thread/49009/geolite-country#dis-post-286318
I have a small php routine in a snippet. I am getting this error when the snippet runs:

« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« PHP Parse Error »

PHP error debug
Error: require_once() [function.require-once]: URL file-access is disabled in the server configuration
Error type/ Nr.: Warning - 2
File: /home/public_html/manager/includes/document.parser.class.inc.php(770) : eval()’d code
Line: 1

I guess this is a problem with our configuration, but not being a modx guru I cannot work out what needs changing and where.
Can anyone point me in the correct direction?

Thank you for reading this question.


REFERENCES:
========

Snippet is:
<?php

require_once("http://www.domain.com/geoip.inc");

$gi = geoip_open("http://www.domain.com/GeoIP.dat",GEOIP_STANDARD);

$country_code = geoip_country_code_by_addr($gi, $_SERVER[’REMOTE_ADDR’]);
$country_name = geoip_country_name_by_addr($gi, $_SERVER[’REMOTE_ADDR’]);

geoip_close($gi);

switch ($country_code){
case "":
?>UNKONWN !!!
<?php;
break;
default:
echo $country_name;
break;
}

?>


Our setup:
MODx version 1.0.3
Version codename rev 6653
phpInfo() View
Access permissions Enabled
Server Time 12:46:32
Local Time 12:46:32
Server offset 0 h
Database name domain_com_modx
Database server 127.0.0.1
Database Version 5.0.92-community-log
Database Charset latin1
Database Collation Charset latin1_swedish_ci
Table prefix modx_
MODX_BASE_PATH /home/public_html/
MODX_BASE_URL /
MODX_MANAGER_URL http://www.domain.com/manager/
MODX_MANAGER_PATH /home/public_html/manager/
MODX_SITE_URL http://www.domain.com/


]]>
Robert_J Jun 07, 2011, 06:51 AM https://forums.modx.com/thread/49009/geolite-country#dis-post-286318