I want to update the status of a FAN-PAGE by PHP with the help of the Facebook graph api. google says: doesn't work.
Now I want to update my own user status by PHP. My main problem is how to login my own user to the graph api (with PHP), without using a browser and without funny PHP workarounds.
You need several things to update your facebook profile or a page's feed: a facebook application (client_id, client_secret), profile_id, and access_token (publish_stream, manage_pages, offline_access permissions)
You need offline_access because if not, then the access token will expire. If you've read that you don't need offline_access if you already have publish_stream specified, they just meant that you don't need it always.
To publish a post is easy:
Now how to get the profile_id and access_token, you can use my app post panda, or make your own script. I'll include it here:
I'm using my cURL wrapper class, xhttp
There's no way for you to act on behalf of a user (even your own user) without interacting with him through a browser at least once to get theoffline_access
.How to get the
offline_access
permission and how to use it from there onward is explained in this answer.EDIT:
Please read the comments! thanks @zerkms!
In both cases you need to get
publish_stream
permission http://developers.facebook.com/docs/authentication/permissionsThis can be done with FB.login()
More information: http://developers.facebook.com/docs/authentication
After that you can just update status with graph api post: http://developers.facebook.com/docs/reference/api/post