There are a lot of examples how to get user permission to write on his wall, and how to obtain access token for writing to wall of pages owned by some user. But how about writeing to application wall, from that application? Access token for this wall is not between access tokens you get with geting “manage_pages” rights.
But it is simple. You just go to:
and you will get access token, which can be used for posting on application wall.
PHP code can look like this:
$ch = curl_init(); curl_setopt($ch,CURLOPT_URL,"https://graph.facebook.com/$appid/feed"); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch,CURLOPT_POST,true); $post = array("access_token" => $access_token); $post["message"] = $message; curl_setopt($ch,CURLOPT_POSTFIELDS,$post); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); $ret = json_decode(curl_exec($ch)); curl_close($ch);
Of course, additional field, link etc… can be added. More can be found on facebook documentation which covers 95% of unneeded features and 5% of needed :-))