0
$user = $request->getGraphObject->asArray();

What's wrong with this line, was trying to convert the returned data of the use to an array.

    $session = new Facebook\FacebookSession($_SESSION['facebook']);
    $request = new Facebook\FacebookRequest($session, 'GET', '/me');
    $request = $request->execute();
    $user = $request->getGraphObject->asArray();
    print_r($user);

I am getting this error.. [14-Jan-2016 10:11:06 America/New_York] PHP Notice: Undefined property: Facebook\FacebookResponse::$getGraphObject in /home/skoolynk/public_html/app/init.php on line 15 [14-Jan-2016 10:11:06 America/New_York] PHP Fatal error: Call to a member function asArray () on a non-object in /home/skoolynk/public_html/app/init.php on line 15

1
  • Does $request->getGraphObject() work (i.e. a method call)? Commented Jan 14, 2016 at 15:41

1 Answer 1

0
$user = $request->getGraphObject->asArray();

should be

$user = $request->getGraphObject()->asArray();

https://developers.facebook.com/docs/php/GraphObject/5.0.0

Sign up to request clarification or add additional context in comments.

3 Comments

thanks Alex but i tried it and it failed, i changed my approach to this:
$session = new Facebook\FacebookSession($_SESSION['facebook']); $response = new FacebookRequest($session, 'GET', '/me'); $response = $response->execute(); $object = $response->getGraphObject(); print_r($object);
it works well though you have to include, use Facebook\FacebookRequest;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.