From facebook, i want to fetch Hometown details . from it i want to separate city,state, country. These fields are separated by comma. so i can split them by comma.
my problem is: as soon i enter city name in hometown field of facebook, it is giving combination of city,state and country. but sometime it is giving combination of city and country so, when i split this string by comma, how to i know that second element is state or country.
I can do one thing, i can check the length of array, if it has three filed then it has city/state/county. else city/county.
Is this ture? can it have more files.
Just query the FQL user
table:
SELECT hometown_location FROM user WHERE uid=me()
This would return something like:
[
{
"hometown_location": {
"city": "xxxxx",
"state": "xxxxx",
"country": "xxxx",
"zip": "xxxxx",
"id": xxxx,
"name": "xxx, xxx, xxxxx"
}
}
]
Of course some of the fields will be empty if the user didn't set them. (result set returned using the fql.query test console)