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!