I am trying to pull facebook posts onto my site so that I can save and display it in my own format. I am trying to use the facebook-php-sdk library, found on the Facebook Developer pages. I used the following code after I required the library:
$facebook = new Facebook(array(
'appId' => 'MY APP ID',
'secret' => 'MY APP SECRET',
));
// Get User ID
$user = $facebook->getUser();
print_r($facebook);
print_r($user);
The print_r into $facebook showed me a full facebook object, so I know its being created properly.
object(Facebook)#325 (9) { ["sharedSessionID":protected]=> NULL ["appId":protected]=> string(15) "[MYAPPID]" ["appSecret":protected]=> string(32) "[MYAPPSECRET]" ["user":protected]=> int(0) ["signedRequest":protected]=> NULL ["state":protected]=> NULL ["accessToken":protected]=> string(48) "[MYAPPID]|[MYAPPSECRET]" ["fileUploadSupport":protected]=> bool(false) ["trustForwarded":protected]=> bool(false) }
(I took my app id and app secret codes out of the quote above).
However, the print_r into $user displayed
int(0).
What am I missing here?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…