Fernando Pombeiro
Fernando Pombeiro

Reputation: 51

Facebook PHP SDK returns no node specified error

So I am running a query to return DAU data using the Facebook PHP SDK. I am positive that I am logged in and I have an app access token...yet when I run the query I am getting a "No Node Specified" error. I have seen this question elsewhere but everyone seems to think that it is a login error....but I can $fb->getUser() and/or get an app_access token...so I don't think it's a login problem. Any other ideas? Thanks.

    try {
    include("facebooksdk/src/facebook.php");
}
catch (Exception $e) {
    echo "$e" . "<br/>";
    die($e);
}
$appId = 'xxxxxxxx';
$appsecret= 'xxxxxxxxxxxxxxxxxxxxxxxx';
$fb = new Facebook(array(
    'appId' => $appId,
    'secret' => $appsecret,
    'oauth' => 'true'
));

$me = $fb->getUser();
$app_token = $fb->getAccessToken();
echo "$me" . "<br/>";
if(!$me) {
   // header("Location:{$fb->getLoginUrl(array('req_perms' => 'email,offline_access'))}");
    $login_url = $fb->getLoginUrl();
    echo $login_url;

}

if($me && $accesstoken) {
    try {
        $result = $fb->api('/insights/application_active_users', array('access_token'=>$app_token));

        print_r($result);
        }
    catch(FacebookApiException $e){
        echo $e->getMessage();
    }
}
echo "<pre>";

Upvotes: 0

Views: 6699

Answers (1)

Igy
Igy

Reputation: 43816

It means you haven't specified which object you want the insights for

Replace

$result = $fb->api('/insights/application_active_users', array('access_token'=>$app_token));

with

$app_id = YOUR APP ID HERE;

$result = $fb->api($app_id.'/insights/application_active_users', array('access_token'=>$app_token));

Upvotes: 2

Related Questions