I have a simple PHP page that will be used to post to my own wall.
I got an offline_access token, which has read_stream and publish_stream permissions.
define('FB_APIKEY', 'MY_APP_KEY');
define('FB_SECRET', 'MY_APP_SECRET');
define('FB_SESSION', 'MY_OFFLINE_TOKEN');
require_once('facebook.php');
try {
$facebook = new Facebook(FB_APIKEY, FB_SECRET);
$facebook->api_client->session_key = FB_SESSION;
$attachment = array(
'message' => 'some meesgae',
'name' => 'This is my demo Facebook application!',
'caption' => "Caption of the Post",
'link' => 'mylink.com',
'description' => 'this is a description',
'actions' => array(array(
'name' => 'Get Search',
'link' => 'google.com'
))
);
$result = $facebook->api('/me/feed?access_token=' . FB_SESSION,
'post',
$attachment);
var_dump($result);
} catch(Exception $e) {
echo $e;
}
When I run this, I get "OAuthException: Application Validation Error".
I confirmed that my offline token is good. When I switch to https://graph.facebook.com/me?access_token=[MY_OFFLINE_TOKEN], it correctly returns my public profile in JSON format.
So, I think I'm doing something wrong with calling the API somewhere, but for life, I can't understand me. I have been struggling with this problem for the last two days. Can someone please help !: (
Prank