Как отправить сообщение с полем message_tags, используя Graph API в PHP - PullRequest
8 голосов
/ 02 декабря 2011

Я хочу отправить сообщение с message_tags с помощью Graph API.

Я подтвердил сообщение только на PHP, но не работает с 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 документа

---------
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
---------

https://developers.facebook.com/docs/reference/api/post/

Допустимые области: read_stream и publish_stream.

Ответы [ 2 ]

4 голосов
/ 27 февраля 2012

Очевидно, message_tags может быть прочитано только через API. Запись message_tags не поддерживается. См. отчет об ошибке и ответ на Facebook от 22.11.2011.

0 голосов
/ 28 января 2012

добавьте эту строку кода, чтобы автоматически опубликовать ваше сообщение на стене

if ($user) {
    $attachment =  array(
        //'access_token' => $access_token,
        'message' => "Amazing stuff by I just took part in their  by dragging and dropping items I would like to win, and who knows, I could get lucky!",
        'name' => "",
        'link' => "http://www.facebook.com/abc?sk=app_111111111111",
        'description' => "Pick your  and you could actually win all the items that you pick!",
        'picture'=> "http://www.abc.in/img/dp.png"
        );
    //var_dump($attachment);
    $facebook->api('/me/feed', 'POST', $attachment);
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...