-1

Possible Duplicate:
Posting Photo to facebook fan page via iOS app by regular non-admin users
Facebook PHP SDK app to upload photo to page

i am using the following code to post a pic to my fan page for which i have manage_pages permissions , but it posts to my own timeline instead of my fan page when i try to post photos , but it works well when i try to post just text !

$fb = new Facebook(array(
            'appId'  => $appID,
            'secret' => $appSecret,
            'cookie' => true,
            'fileUpload' => true
        ));
        $comic_info = get_records('comics',1,0,'main_pic,title','id  DESC','sent=0');

        $photo = '../../uploads/pics/'.$comic_info[0]['main_pic']; // Path to the photo on the local filesystem


            $fb->setAccessToken('AAAFw2ez8BtQBANifSkVR9WvZBfVsuhHZCtiZCtOaJ9OaXeANHLBpc7hJuEWFuQSZBWZCvpiuFGWE7my396OFd3KbkrkyW8Pu8ndPx4tFBBAZDZD');
            $postResult = $fb->api('/150391721775239_35388/photos', 'POST', array(
                                     'source' => '@' . realpath($photo),
                                     'message' => $comic_info[0]['title']
                                     )
                                  );

150391721775239_35388 is the timeline photos album , i also tried to use my page id , but in vain !

Community
  • 1
  • 1
Adham shafik
  • 1,044
  • 1
  • 13
  • 16
  • 1
    @Igy Please look at the potential duplicate before marking it as such. This is a PHP question. The one you've linked to is an IOS question. – maiorano84 Jan 10 '13 at 04:15
  • 1
    Please look at my answer on the question i marked as a duplicate: both questions are referring to the same API, which has the same limitation regardless of the source SDK of the API calls – Igy Jan 10 '13 at 05:04

1 Answers1

-1

i tried a way to :- 1- get page's access token 2- set this access token

you can find your access token by going to the graph explorer and calling

/PAGE_ID?fields=access_token

then you just replace it there , so it will return page's access token instead of your timeline's access token !

Adham shafik
  • 1,044
  • 1
  • 13
  • 16