n8dog
asked on
regex / cURL question
im need to separate the following into separate variables:
Country: UNITED STATES (US)
City: Somewhere, AK
Latitude: 12.7696
Longitude: -123.4588
I've got the cURL placing it into a result variable, but i need to separate it into:
$Country
$City
$Latitude
$Longitude
anyone ??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
country isnt always UNITED STATES (US), and so on...
ASKER
your explode code results in:
UNITED STATES (US) City: Scottsdale, AZ Latitude: 33.686 Longitude: -111.87 -> $result
$Country = $result;
$Country = explode(":", $Country);
echo $Country[1]; // This will echo "UNITED STATES (US)"
UNITED STATES (US) City
UNITED STATES (US) City: Scottsdale, AZ Latitude: 33.686 Longitude: -111.87 -> $result
$Country = $result;
$Country = explode(":", $Country);
echo $Country[1]; // This will echo "UNITED STATES (US)"
UNITED STATES (US) City
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
keep in mind the result from the query is this:
UNITED STATES (US) City: Scottsdale, AZ Latitude: 33.686 Longitude: -111.87
and all portions are variable depending on the IP going in...