<ip2locationapi>
<countryCode>TR</countryCode>
<countryName>Turkey</countryName>
<region>Istanbul</region>
<city>Istanbul</city>
<latitude>41.0186</latitude>
<longitude>28.9647</longitude>
</ip2locationapi>
tarayıcıda çalıstırdığımda ki sonuç bu.
SimpleXML
Simplexml support enabled
Revision $Revision: 299424 $
Schema support enabled
SimpleXml enabled durumda
Bu sonuç çıkıyorsa, simplexml_load_file seçeneğinin çalışmaması için bir neden yok. Öyleyse bir de şunu yapın.
Önce echo $_SERVER['REMOTE_ADDR']; diyerek hostunuzda çalıştırın. Ekranda çıkan ip adresini alın ve şu url de IP_ADRESI yazan yere elle yazın:
<?php
$ipaddress = "IP_ADRESI";
$locationstr = "http://api.locatorhq.com/?user=aaaz2568&key=cb70014a000193e4a21f8c5d546128d7ce231dae&ip=".$ipaddress."&format=xml";
$xml = simplexml_load_file($locationstr);
print_r($xml);Eğer herhangi bir hata varsa, bu şekilde de bir sonuç döndürmemesi lazım ama bende şunu dönderiyor:
SimpleXMLElement Object ( [countryCode] => TR [countryName] => Turkey [region] => Istanbul [city] => Istanbul [latitude] => 41.0186 [longitude] => 28.9647 )
Sizde de buna benzer bir sonuç dönmeli.