0

So I have stored the "access_token" and marked it as "offline_access". All that is fine. Now, what I am trying to do is: I want a PHP page to "refresh"/be executed every minute, and then use that token that I stored (which I want to change at anytime manually, say from a field in the database) and then change the status of the user. Say I have the tokens for 3 of my facebook accounts.

I know how to post and all that, but when I try it without a session, it is telling me I need to create a session to do it. However, this is server-side. I don't know how to do the session without seeing the "login" button of Facebook on the server side.

How to do this? Any thoughts on how to make my PHP page, when executed, create a new Facebook object from the Facebook PHP class, and then plug in the whatever Access Token and UID maybe, and then post to the wall of the user?

Thanks!

JoHa
  • 1,989
  • 10
  • 28
  • 42

1 Answers1

0

Answered here: Facebook offline access step-by-step

Community
  • 1
  • 1
Stefan H Singer
  • 5,469
  • 2
  • 25
  • 26
  • Thanks, but I am using PHP, and it seems the post you redirected me into is an old one. Facebook use OAuth2 right now, and the session_key is deprecated. What I am trying to do is "imitate" as if the account logged in on my server, as in a session was created by clicking on the "login" button for facebook. If this doesn't require a session (by any chance), when could you please let me know how to do it then in PHP server-side (to be executed on my dedicated server.. user won't see and is not required to open the link it should do it on its own)? – JoHa Jan 15 '11 at 11:10
  • You sure that it won't work? The latest answer was useful for people in december 2010. – Stefan H Singer Jan 15 '11 at 11:17
  • It works for the old REST api, but not the new Graph API. I am trying to do it using the Graph API. Any thoughts? – JoHa Jan 15 '11 at 16:37
  • Can't you use them interchangeably? As long as your authenticated, in some manner? Sorry, haven't used Graph API that much. – Stefan H Singer Jan 15 '11 at 16:41
  • http://thinkdiff.net/facebook/php-sdk-graph-api-base-facebook-connect-tutorial/ I am following that example, and I got stuck because the new Graph API does not use Session Key anymore.. it just uses ACCESS TOKEN.. now what I am stuck with is I am trying to store my 3 facebook Access Tokens in the database.. and then logoff from my accounts and turn off my machine.. and then the server on its own will go to each accont every hour and post something on each account.. the example I found shows how to use Graph API with Sessions.. but on server sessions need user to "click login".. – JoHa Jan 15 '11 at 17:01
  • To make it clearer, I am facing the difficulty in the "PUBLISHING".. the read works fine using access token without a session.. even through GET.. HOWEVER I want the publishing to work – JoHa Jan 15 '11 at 17:05
  • Sorry, I'm out of ideas. Perhaps, one day, facebook will properly document their API. – Stefan H Singer Jan 15 '11 at 17:12
  • Lol no, my bad not you out of ideas! I was thinking ALL THE TIME that without a $session, I can't make calls. Stupid me removed the if($session) from the code and it turns out it works fine as long as I use cURL with POST.. LOL Thanks for the help! – JoHa Jan 15 '11 at 17:31
  • @johnshaddad: I was planning of making a tutorial about this, but as long as you already figured it out have your steps written in an answer here and accept it ;) – ifaour Jan 16 '11 at 10:05