本文介绍了如何在PHP中使用Graph API发送带有message_tags字段的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用Graph API发布带有message_tags的消息。
I want to post message with message_tags using Graph API.
我确认消息只发布在PHP中,但不能使用message_tags ..
I confirmed message only post in PHP, but don't work with message_tags..
这是示例代码。
---------
<?php
require_once('facebook.php');
$facebook = new Facebook(array(
'appId' => '127916833975***', // masked
'secret' => 'a3271136ad68587d8e83171148f93***' // masked
));
$request_params = array('message' => mb_convert_encoding('test posting message', 'UTF-8', 'EUC-JP'));
$tags = array(
'id' => '100000834278***', // masked
'name' => 'MY_FRIENDS_NAME', // masked
'offset' => 0,
'length' => 15 // friend name length
);
$request_params['message_tags'] = $tags;
$facebook->api('/feed', 'POST', $request_params);
?>
---------
在文档message_tags字段中,
In document message_tags field,
---------
object containing fields whose names are the indexes to where objects are
mentioned in the message field; 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
---------
允许的范围是read_stream和publish_stream。
Allowed scopes are read_stream and publish_stream.
推荐答案
显然, message_tags
只能被读取通过API。不支持写 message_tags
。从11/22/2011看到这个。
Apparently the message_tags
can only be read via the API. Writing message_tags
is not supported. See this bug report and facebook response from 11/22/2011.
这篇关于如何在PHP中使用Graph API发送带有message_tags字段的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!