То, что вы хотите сделать, это использовать «Страница access_token
».Чтобы получить это, вам нужно будет создать приложение и предоставить ему разрешение manage_pages
.
Вы должны увидеть в Документация по аутентификации раздел, который называется «Страница входа».Вы можете предоставить вашему приложению разрешение manage_pages
, перейдя по этому URL:
https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=manage_pages&response_type=token
Не забудьте заменить YOUR_APP_ID
и YOUR_URL
правильными значениями для вашего приложения и URL.(URL-адрес может быть любым URL-адресом, куда Facebook отправит вас после закрытия диалогового окна).Вы увидите диалоговое окно, которое выглядит примерно так:
Once you have the correct permission, you'll want to make a call to this URL :
https://graph.facebook.com/me/accounts?access_token=TOKEN_FROM_ABOVE
You will get a response similar to :
As you can see from the image, you will receive a list of all the pages that the user administers along with an access_token
for each page.
You use this access_token
to make posts on behalf of the page. Since you have not stated what programming language you are using I will give an example in php .В php размещение на странице будет выглядеть примерно так:
$facebook->setAccessToken(ACCESS_TOKEN_YOU_RETRIEVED_EARLIER);
$attachment = array('message' => 'this is my message',
'name' => 'This is my demo Facebook application!',
'caption' => "Caption of the Post",
'link' => 'http://mylink.com',
'description' => 'this is a description',
'picture' => 'http://mysite.com/pic.gif',
'actions' => array(array('name' => 'Get Search',
'link' => 'http://www.google.com'))
);
$result = $facebook->api('/PAGE_ID/','post',$attachment);
Надеюсь, это поможет!
Удачного кодирования!