0

I'm writing some SQL code for a website I'm constructing and I've come across this error recently:

Parse error: syntax error, unexpected end of file in /home/xxxxxxxx/public_html/geo.php on line 281

//$xmlstring = file_get_contents
( "http://www.infosniper.net/xml.php?ip_address=".$_SERVER["REMOTE_ADDR"] );


$xmlstring = file_get_contents ( "http://www.infosniper.net/xml.php?k=PurChAseAkEY&ip=".$ip_address );
$xml = new SimpleXMLElement ( $xmlstring );

echo $xml->result[0]->ipaddress;
echo $xml->result[0]->hostname;
echo $xml->result[0]->provider;

echo $xml->result[0]->country;
echo $xml->result[0]->countrycode;
echo $xml->result[0]->countryflag;
echo $xml->result[0]->state;
echo $xml->result[0]->city;
echo $xml->result[0]->areacode;
echo $xml->result[0]->postalcode;
echo $xml->result[0]->dmacode;
echo $xml->result[0]->latitude;
echo $xml->result[0]->longitude;
?>

I'm a bit confused because at the end of line 281 is an </html> tag.

Does anybody have any idea why I would be getting this error with the above snippet?

FLICKER
  • 6,439
  • 4
  • 45
  • 75
Wa2hot4
  • 11
  • Do you have an api key for infosniper.net that you are using, or are you trying to get the file with PurChAseAkEY? This returns errors when I go to the url with my ip. What are the contents of the rest of that file if you are using a key and you get actual results? – Adam Apr 09 '16 at 00:18
  • 1
    The error you're getting is a PHP error; generally because you've missed a closing brace or something similar in your code. – andrewsi Apr 09 '16 at 00:29
  • How come this is related to sql? Please use tags properly. – FLICKER Apr 09 '16 at 05:28
  • Probably ** – kakurala Apr 09 '16 at 06:40

0 Answers0