简体   繁体   English

如何使用FB graph API标记朋友?

[英]how to tag a friend using FB graph API?

I am trying to tag a friend in FB message to be posted, I am using PHP, and for FB I am using FB Auth API 2.0, I have tried to get related information from facebook developers forum, however can't find enough information for this one. 我正在尝试在要发布的FB消息中标记一个朋友,我正在使用PHP,对于FB我正在使用FB Auth API 2.0,我试图从facebook开发者论坛获取相关信息,但是找不到足够的信息这个。 Can anyone suggest me from where to get started for this? 谁能建议我从哪里开始呢? any links to related documentation or forum links using which I can get started? 有任何相关文档链接或论坛链接可以用来入门吗?

You use the message_tags field of the Post object. 您使用Post对象的message_tags字段。 Check out the docs : 查看文档

message_tags: object containing fields whose names are the indexes to where objects are mentioned in the message field; message_tags:包含字段的对象,其名称是在消息字段中提及对象的索引; each field in turn is an array containing an object with id, name, offset, and length fields, where length is the length, within the message field, of the object mentioned 每个字段又是一个包含对象的数组,该对象包含id,name,offset和length字段,其中length是消息字段内所提及对象的长度

Something like this: 像这样:


    $facebook->setFileUploadSupport(true);
    $tags = array(
    ‘tag_text’ => ‘ak Yip’,
    ‘tag_uid’ => 642536423,//it’s my id on facebook as a sample
    ‘x’ => 10,
    ‘y’ => 10,
    );

    $args['tags'] = array($tags);
    $args['image'] = ‘@’ . realpath($fn);
    $data = $facebook->api(‘/me/photos’, ‘post’, $args);

Note: **One:Your app need to get permissions like 'user_photo_video_tags' and 'friends_photo_video_tags'. 注意:**一个:您的应用需要获得“ user_photo_video_tags”和“ friends_photo_video_tags”之类的权限。

Two:X,Y is proportion, not coordinate. 二:X,Y是比例,不是坐标。 Don't put value over 100.** 价值不要超过100。**

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM