I want to fetch user's country by user's hometown.
I am using the latest Graph API v2.3 and I know FQL is deprecated in this version, so I can no longer use Facebook Graph API - how to get user country?
The only way is to do it by Graph API, but the tricky thing is
$fb_user = (new FacebookRequest($session, 'GET', '/me'))->execute()->getGraphObject(GraphUser::className());
var_dump($fb_user->getProperty('hometown'));
only returns the location Page id and name, then I do
$graph_obj_hometown = (new FacebookRequest($session, 'GET', '/' . $hometown_id, array('locale' => 'en_US')))->execute()->getGraphObject();
var_dump($graph_obj_hometown->asArray());
there is no country information in it, anyone knows how to get user's country?
Also, I have tried to get user hometown as a GraphLocation object then maybe I can use getCountry() method but it is still not working
$fb_user->getProperty('hometown', 'Facebook\GraphLocation');
the object only stored location name and location page id in the object.
Can anyone please help me?