0

Using the code under ... when ever i try to post a link to facebook page it posts as my account but when i remove the link below it post it as the page itself .... ? I want to post the link too but as the page !!!

if(isset($_POST['title']) and $_POST['title'] != '' ){

    try{
        $message = array(
            'message' => $_POST['title'],
            'link' => $_POST['link'],
            'title' => $_POST['title'],

        );
        $url = '/'.$_POST['pageid'].'/feed';
        $result = $fb->api($url, 'POST', $message);
        if($result){
            echo 'The data is posted!';
        }
    }

    catch(FacebookApiException $error){
        echo $error->getMessage();
    }

}

1 Answer 1

0

Use, the page access token for posting. This will post as a page whatever you post.

To do this, simply give an additional parameter in your parameters list- access_token.

To get the page access token, you should have the manage_pages permissions, and api is- /me/accounts?fields=access_token. This will list all your pages, with the page access token.

You can also have a never expiring page token, see here: What are the Steps to getting a Long Lasting Token For Posting To a Facebook Fan Page from a Server

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.