Search code examples
phpfacebookfacebook-graph-apiyiifacebook-page

facebook page posting not working properly


Posting photos/videos in Facebook page from php application does not give any error but the post does not show up in page feed.

Same code used to work before the new facebook rules came.

Following are the permission i have taken to post on page:

publish_actions,manage_pages

code used:

    $config = array();
    $config['appId'] = '{appid}';
    $config['secret'] = '{app secret}';

    $facebook = new Facebook($config);

    $facebook->setAccessToken({fb_token});
    $facebook->setFileUploadSupport(true);
    $params = array(
                          'message'       =>  "{title}",
                          'name'          =>  "{name}",
                          'link'          =>  "{link}",
                          'picture'       =>  "{picture url}",

                      );
$facebook->api("{page-id}/feed","POST",$params); 

Thank you in advance for any help.


Solution

  • Two things may be the problem:

    Also, use try-catch to check for any errors, and see if the API call responds:

    try {
        $response = $facebook->api("{page-id}/feed","POST",$params);
        var_dump($response);
    } catch (Exception $e) {
        var_dump($e);
    }