1

I have been trying to post status to my facebook page through a PHP script which runs on my web server. I have succeeded in posting it via app i.e creating an app and using its app id and secret.

Here is the code snippet of it:

$pgid="############";
$token="###############################";
$this->tasks = new Facebookclass(array(
  'appId'  => '##########',
  'secret' => '##########',
  'cookie' => true,
));
$post = array('access_token' => $token, 'message' => $message);
try{
  $res = $this->tasks->api('/'.$pgid.'/feed','POST',$post);
} catch (Exception $e){
  echo $e->getMessage();
  die();
}

It's working fine and updating the status of my facebook page, but that change/update is only visible only to the admin (ie: me) and not to anyone else who views the page.

If I update status normally by FB logging then it's visible to all, but not the status uploaded via this app.

cHao
  • 84,970
  • 20
  • 145
  • 172
Mudit Dugar
  • 121
  • 1
  • 3
  • 12
  • hmmmm, disable `Sandbox mode` in your app settings...also maybe when you authorized the app you selected "`only me`"? (not sure if this is related but it's worth to check it) – ifaour Oct 25 '12 at 22:42
  • Thanks for it:) it works now also i would like to add link in that message like $message="Download on Android or iPhone" but if i am doing this its dumping the html in the status. Any suggestions? – Mudit Dugar Oct 25 '12 at 23:59
  • you are welcome. What was the issue? – ifaour Oct 26 '12 at 00:00
  • You cannot add html tags to your posts, but there's a link parameter that the `feed` connection accepts, an example can be found in my [tutorial](http://www.masteringapi.com/tutorials/how-to-post-a-message-on-the-user-wall-using-facebook-graph-api/33/#using_the_php-sdk). – ifaour Oct 26 '12 at 00:05
  • ok can u give me a complete list of parameters allowed? and can we have two links or two images? – Mudit Dugar Oct 26 '12 at 00:19
  • check the [`user`](https://developers.facebook.com/docs/reference/api/user/) object to know what can be posted. And I don't think you can have two links in the `link` parameter, put you can always put them in the `message` field even though this won't be practical. As for images I don't know. – ifaour Oct 26 '12 at 01:05
  • How to disable sandbox [enter link description here][1] [1]: http://stackoverflow.com/questions/20706322/how-to-disable-sandbox-mode-for-app-in-new-facebook-developer – Jakub Stach Nov 26 '14 at 21:13

1 Answers1

0

The reason why it was visible to the admin only was because the Sandbox setting was enabled. Disabling sandbox should make the post visible.

phwd
  • 19,975
  • 5
  • 50
  • 78