Possible Duplicate:
How to access fb access token form server running program ( python )
I have made a app that allow me to login and store the fbuid and some other things as i'm just test things out. I have started to make a php commandline program that also uses the php-sdk as my web app does. The only problem is that as the php commandline program runs outside the browser it does not have access to the session to pickup the access_token which makes the program display 0 for getuser. I have thought that storing the access_token in the db as well as the others, and fetching this from the db and setting it, then the program should display the user as well as have access to the Graph API. Then how could it check if the access_token as changed if i'm not logged in through the web app which it can not change the access_token due to there's no auth interaction to the command program.
Thanks
Having an access_token does not mean the PHP SDK can automatically extract the user id from it. If you want your comand line script to know the user, you’d have to make a request to
/me
using the access token first. (After that, getUser will still not work, but you know the user id and can put it into your API calls manually if necessary.)And for checking the access_token for validity, see https://developers.facebook.com/docs/howtos/login/debugging-access-tokens/#step1