Reputation: 11
I need to publish in facebook wall , the site that I developing is a news portal, for this task I download php sdk and I create a new app.
I have a problem to login and feed, because I need that the server using a cron job list new articles that isn't publish and publish them.
$facebook = new Facebook($config);
$uid = $facebook->getUser();
Always I getting a $uid = 0, I don't need that to show a login dialog because I need that the app that i create do this.
I was looking but I didn't find a way to do that. I see many examples but all need that the user login using a pop up dialog.
Upvotes: 1
Views: 405
Reputation: 576
You can't get facebook user if he doesn't give permissions to your application.
You should redirect (unknown) user to permissions dialog or show a permissions popup, with requesting publish_stream additional permission. When user grant your app requested permissions, you will have what you need: uid, access token and you will be able to publish posts.
Upvotes: 2