Link to home
Start Free TrialLog in
Avatar of n8dog
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
Avatar of AnthonyP9618
AnthonyP9618
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of n8dog
n8dog

ASKER

ok..

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...

Avatar of n8dog

ASKER

country isnt always UNITED STATES (US), and so on...

Avatar of n8dog

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

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial