Jump to content

Problems accessing Maxmind Database


MortimerJazz

Recommended Posts

This is a bit of a wierd problem, but I haven't been able to solve it so I thought I'd post it up here.

 

Basically, I'm using the following function to access Maxmind's GEO IP database (so that I can target visitors to my site based on their location):

 

<?php

// This code demonstrates how to lookup the country by IP Address

include("geoip.inc");

// Uncomment if querying against GeoIP/Lite City.
// include("geoipcity.inc");

$gi = geoip_open("/home/bounce6/public_html/geoIP/GeoIP.dat",GEOIP_STANDARD);

$ip=$_SERVER['REMOTE_ADDR'];

$country=geoip_country_code_by_addr($gi, "$ip");


geoip_close($gi);

?>

 

The function is being called using this line from a separate file:

include "/home/username/public_html/mydomain.com/functions/getCountry.php";

 

Now the code does what it's supposed to do, in as far as it's able to give me a string which details where a visitor is located.

 

However, for some strange reason it seems to be adding a new HTML tag into my existing header tag.

 

The code which has been inserted is as follows:

 

<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>

 

I've managed to isolate the problem to this script, so I know that there must be an issue with it, but I'm not quite sure what it is.

 

Can anyone suggest why this extra source code is being produced? Is there a particular function that I'm using which is forcing additional headers or something?!

 

Any thoughts would be really appreciated!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.