Nosairat
Nosairat

Reputation: 492

Posting with privacy setting through Facebook API

I am trying to post on Facebook with custom privacy setting:

$postRequest=new FacebookRequest($sess,'POST','/me/feed',array(
  'message'=>'My first post using graph api ',
  'description'=>'new Description',
  'privacy'=>array('description'=>'Only Me','value'=>'SELF'),
  'link' => 'www.example.com'
)

but an error occurs:

(#100) privacy must contain a valid privacy 'value'

What's wrong?

Upvotes: 2

Views: 1281

Answers (1)

Stéphane Bruckert
Stéphane Bruckert

Reputation: 22903

You were close. You must encode your PHP array into a JSON array:

'privacy' => json_encode(array('description'=>'Only Me','value'=>'SELF')),

Upvotes: 1

Related Questions