0 votes
in Education by (1.7m points)
When i use graph api to post a picture, everything is ok. The photo is right in the album. The problem is that the picture is not mention on the wall. It's just include in the album with nothing on the wall.

I use basic code like that :

            $facebook->setFileUploadSupport(true);     

            $file = "@".realpath(PIC);  

            $result = $facebook->api(

            '/PAGE_ID/photos/',

            'post',

            array('access_token' => $access_token,

                  'type' => 'status',

                  'message' => stripslashes(MESSAGE),

                  'image' => $file

                )

            );

Do you know how to force the picture and the message to appear on the wall as a status?

JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by (1.7m points)
The only workaround could i figure out is to get Wall Photos album's ID and post photo to that album to appear on wall..

Unfortunately there is no easier way to force it out. Here is the sample code:

    $result = $facebook->api('/'.$pageID.'/albums/?access_token='.$access_token, 'get' );

    $albumArr = $result['data'];

    $albumID = 0;

    for($j = 0 ; $j < sizeof($albumArr) ; $j++) {

        if ($albumArr[$j]['type'] == 'wall') {

            $albumID = $albumArr[$j]['id'];

        }

    }

    $result = $facebook->api('/'.$albumID.'/photos/', 'post' , array('access_token' => $access_token,

              'type' => 'status',

              'message' => stripslashes(MESSAGE),

              'image' => $file

            ) );

Related questions

...