hi guys, how are you?
I hope someone can help me with this as its been bugging me all day, and I'm sure there is a very simple explanation.
Basically, what I have at the moment is this:-
$ip = ($_SERVER["REMOTE_ADDR"]); $xml = file_get_contents("http://xxxxxxxxxxxxxx);
This returns me the following in XML:
<?xml version="1.0" encoding="UTF-8"?> <Response> <statusCode>OK</statusCode> <statusMessage></statusMessage> <ipAddress>188.8.131.52</ipAddress> <countryCode>UK</countryCode> <countryName>UNITED KINGDOM</countryName> </Response>
What I want to be able to do now, is store the countryCode in a variable called $country.
Surely it can't be so difficult??? I'm so stuck. I've tried this, and think i'm on the right track, but its not working.
$xmlparse = simplexml_load_file($xml); $country=$xmlparse->countryCode; // show country echo $country;
Any help is much appreciated.