I have an iframe page tab facebook app that, for some users on some pages, raises a "CurlException: 3: No URL set!" exception when calling $facebook->api("/me").
Here is the code :
$config = array();
$config['appId'] = APPID;
$config['secret'] = APPSECRET;
$config['cookie'] = true;
$config['fileUpload'] = false; // optional
$facebook = new Facebook($config);
$facebook->setExtendedAccessToken();
$access_token = $facebook->getAccessToken();
if (isset($_GET['tk'])&&($_GET['tk']!="")){
$_SESSION['appat'] = $_GET['tk'];
}
if ($_SESSION['appat']!="")
$access_token = $_SESSION['appat'];
$facebook->setAccessToken($access_token);
$user = $facebook->getUser();
if ($user) {
try {
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
trace("exception $e");
}
}
NOTE : The access token is given by the Javascript sdk as a GET variable as received on the app home page and I store it into a session variable for further uses.