I'm using AMFPHP, and wrote a small function in php to post in facebook whenever it's called:
function postear($pregunta,$winoption,$loseoption) {
require_once("../../facebook.php");
Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYPEER] = false;
$facebook = new Facebook(array(
'appId' => 'xxxxxxxxxxxxx',
'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'cookie' => false
));
$session = $facebook->getSession();
$token = $session['access_token'];
//echo "Post successful !";
$facebook->api( '/me/feed', 'POST', array ( 'message' => '','link' => 'http://www.facebook.com/apps/myapp','name' => 'dummy name'));
}
I'm getting this error:
message = "faultCode:AMFPHP_RUNTIME_ERROR faultString:'An active access token must be used to query information about the current user.'
I'm not very familiar to Facebook's graph api, and kinda of confussed because sometimes i can post correclty by calling my function, and other times gives me above's error. Maybe I need to somehow pass the token to my posting call ?. And what's the purpose of the 'cookie' argument in my call to log me into facebook ?.
Also, the access token is unique ?, or a different one is generated every time someone logs into the app ?.
Thanks for your orientation and thanks for any help.