开发者

Facebook Graph API overriding explicitly set Privacy settings

开发者 https://www.devze.com 2023-03-31 04:13 出处:网络
I\'m having problems setting the privacy for posts created by my App on behalf of the user. The problem is that all the posts are getting their privacy value set as ALL_FRIENDS by the Graph API, even

I'm having problems setting the privacy for posts created by my App on behalf of the user.

The problem is that all the posts are getting their privacy value set as ALL_FRIENDS by the Graph API, even though I'm explicitly setting the privacy value to EVERYONE.

This is the code I'm using to submit:

$query = 'message='. urlencode($message) .'&privacy='. urlencode('{"valu开发者_开发技巧e":"EVERYONE"}');
$url = 'https://graph.facebook.com/'. $obj_id .'/feed?access_token='. $user_fb_access_token;

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $query);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($curl, CURLOPT_REFERER, $referrer);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

$data = curl_exec($curl);

curl_close($curl);

Thats it.

This code worked perfectly up until sometime in August when I noticed it.

Anyone else having this issue?


This is related to the new per-app post privacy control, if is set to Friends so this App can only set privacy as wide as friends.

Please read the following blog post for more info: https://developers.facebook.com/blog/post/543/


In your example, you're creating a comment, not a post. Comments don't support the privacy={} parameter.


This isn't in their graph API docs, but they changed "everyone" to "public" in the UI this month to try and clarify to users what "everyone" meant...

try using '{"value":"PUBLIC"}' and see if it works.

0

精彩评论

暂无评论...
验证码 换一张
取 消