views:

212

answers:

1

Hi, I am developing an iFrame application in facebook. What is the syntax to get the locale of an user? I am using the PHP client library.

I had tried this piece of code:

<?php

   $user_details = $facebook->api_client->users_getInfo($user_id, 'name,hometown_location');
   $locale = $user_details[0]['hometown_location']['city']; 
   echo "Location: ".$locale;
 ?>

But I get the following error msg:

 Fatal error: Cannot use string offset as an array in C:\xampplite\htdocs\FacebookApp\deals.php on line 51

Some one help me with this.

A: 

Using the new PHP SDK:

$me = $fb->api('/me');
$locale = $me['locale'];
daaku
Thank you, but I have retrieved the locale value using the old PHP library itself, `echo $_GET[fb_sig_locale];` . Now i need syntax to retrive the current_location.Pls help me with this.
Angeline Aarthi
Once you get the [`user_location`](http://developers.facebook.com/docs/authentication/permissions) permission, the $me object above will also contain the user's location (`print_r($me)` will help). This is in the [new SDK](http://github.com/facebook/php-sdk) using the [Graph API](http://graph.facebook.com/).
daaku
I've been coding with the old SDK, can I change now? I tried to print the values using var_dump().`$user_details = $facebook->api_client->users_getStandardInfo($user_id,'name,current_location'); var_dump($user_details);` But the result is: `string(0) ""`. Why don't I get any details?
Angeline Aarthi