gerkintrigg Posted September 26, 2013 Share Posted September 26, 2013 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 Quote Link to comment Share on other sites More sharing options...
TOA Posted September 26, 2013 Share Posted September 26, 2013 Use your page id instead of $user in the api call Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.