perl - Facebook Graph - 发布到Fanpage

时间:2013-04-24 19:13:33

标签: facebook perl facebook-graph-api

这不是给我任何错误但是它没有发布到我的粉丝专区。 我会喜欢这方面的帮助!试图自己解决这个问题一直是个过山车。

当然使用正确的令牌进行测试。

#!/usr/bin/perl

use strict;
use warnings;
use open qw(:std :utf8);
use LWP::Simple;
use YAML::Tiny;
use JSON;
use URI;
use utf8;

my $access_token = 'blah';
my $profile_id = '200117706712975';

#Publish to a facebook page as admin
graph_api('/' . $profile_id . '/feed',{
        access_token => $access_token,
        message => 'this is a test!',
        link => 'http://test.com',
        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;
}

1 个答案:

答案 0 :(得分:1)

如果您转储响应对象 - $ resp - 使用Data :: Dumper类似,您将得到帖子未显示的原因。响应对象是JSON。

相关问题