Jump to content

Facebook app to post to a page


gerkintrigg

Recommended Posts

Hello,

 

I want to post automatically to my Facebook page, but not to my personal account. What's the difference in coding?

 

It's linked to my personal account perfectly using the following code:

<?php require_once($root.'includes/facebook_api/facebook.php');
$config = array();
  $config['appId'] = 'whatever';
  $config['secret'] = 'shh. It's a secret';
  $config['fileUpload'] = false; // optional

  $facebook = new Facebook($config);

$user = $facebook->getUser(); // Get the UID of the connected user, or 0 if the Facebook user is not connected.

if($user == 0) {

    $login_url = $facebook->getLoginUrl($params = array('scope' => "publish_stream"));

    echo ("<script> top.location.href='".$login_url."'</script>");

} else {

    try {
            $params = array(
                'message'       =>  "I'm trialing a new post-to-facebook app. Just ignore me.",
                'name'          =>  "Ending Today",
                'caption'       =>  "Get them while they're hot... ",
                'description'   =>  "Pre-owned listings on Truro.com ending today. They will disappear in less than 24 hours, get them now!",
                'link'          =>  "http://www.truro.com/pre-owned_ending_today.php",
                'picture'       =>  "http://www.truro.com/furniture/logo.jpg",
            );

            $post = $facebook->api("/$user/feed","POST",$params);

            $go=$root.'cron_jobs/check_backlink_ncj.php';
			header( 'Location: '.$go ) ;
			die();
        }
        catch (FacebookApiException $e) {
           $result = $e->getResult();
        }

}
?>

but I want it to post to my business page instead.

 

Suggestions, please?

 

Neil

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.