0
我想发布到名为XY的页面,它应该直接显示在页面上,而不是作为来自其他用户(管理员)的发布。这是我从http://qscripts.blogspot.de/2011/02/post-to-your-own-facebook-account-from.html改编的代码,但是这会发布到其他用户的区域而不是主页面。如果我用“我”替换页面ID号码,它会发布到管理页面并正确显示到主区域。作为此页面发布消息到页面墙(不是管理员)
#!/usr/bin/perl -I/opt/ActivePerl-5.16/site/lib/
# http://qscripts.blogspot.de/2011/02/post-to-your-own-facebook-account-from.html
use strict;
use warnings;
use open qw(:std :utf8);
use LWP::Simple;
use YAML;
use JSON;
use URI;
use utf8;
my $access_token = 'top secret';
graph_api('1484559088426611/feed', {
access_token => $access_token,
message => 'Hello World! I’m posting Facebook updates from a script!',
description => 'You want to create a script to read messages and post status updates to your own '
. 'Facebook account, but you find the official documentation confusing and '
. 'you aren’t sure where to start. Search no more because here you’ll find '
. 'the easiest way to do just this.',
method => 'post'
});
exit 0;
sub graph_api {
my $uri = new URI('https://graph.facebook.com/' . shift);
$uri->query_form(shift);
my $resp = get("$uri");
return defined $resp ? decode_json($resp) : undef;
}
谢谢!为了包装这个GET,我需要另一个perl脚本,对吧? –
啊和'manage_pages'设置在脸书里,对吧?如果我是这个页面的管理员,我应该没问题,不是吗? –
为什么其他脚本?您只能将其添加到当前脚本中。获取令牌之前需要设置权限。我不确定你是如何得到令牌的(使用登录流或图形API浏览器) –