I made this small app that basically asks a user to login and post a photo to a FB page. the code I have works great for posting on your own wall, but when it comes to posting to a page I am having some difficulties.
require_once('../src/facebook.php');
$config = array(
'appId' => 'XXXXXXXXXXXXX',
'secret' => 'XXXXXXXXXXXXXXX',
'fileUpload' => true,
);
$facebook = new Facebook($config);
$user_id = $facebook->getUser();
$photo = realpath("mypic.png"); // Path to the photo on the local filesystem
$message = 'Photo upload via the PHP SDK!';
if($user_id) {
try {
$ret_obj = $facebook->api('/PAGE_ID_HERE_??/photos', 'POST', array(
'source' => '@' . $photo,
'message' => $message,));
if i use feed instead of photos, like here
$facebook->api('/PAGE_ID_HERE_??/FEED',
it works, but only posts the message.
i have all permissions needed:
user_photos user_videos publish_action
manage_pages publish_stream