I am trying to migrate an old FBML application to iFrame using the new PHP SDK and GRAPH API, but I cannot figure out how to find a visitor city.
For example, in my own Facebook profile, I list both Current City and Hometown :

But when I try to use the following iFrame application, the location and hometown are not printed, but other data is printed, including my employers and education:
<?php
include_once 'facebook.php';
$facebook = new Facebook(array(
'appId' => "182820975103876",
'secret' => "XXXXXXX",
'cookie' => true,
));
$session = $facebook->getSession();
if (!$session) {
$url = $facebook->getLoginUrl();
print("<script type='text/javascript'>top.location.href = '$url';</script>");
} else {
try {
$me = $facebook->api('/me');
print('<pre>');
print_r($me);
print('</pre>');
} catch (FacebookApiException $e) {
print("Error:" . $e);
}
}
?>
Here is some of the data that I see for myself, the current location is not there:
Array
(
[first_name] => Alexander
[education] => Array
(
[0] => Array
(
[school] => Array
(
[id] => 106509962720287
[name] => Riga Nr. 40
)
[type] => High School
)
[1] => Array
(
[school] => Array
(
[id] => 103130426393616
[name] => RWTH Aachen University
)
[year] => Array
(
[id] => 143018465715205
[name] => 2000
)
[type] => College
)
)
[gender] => male
...........
)
Relationship Alex
source
share