Full_picture 页面参数
Full_picture Parameter for page
我正在使用图表 API 获取访问令牌,使用参考 "pagename?fields=picture" 为我的 facebook 页面在我的网站上使用。
这是我正在使用的功能;
function get_facebook_post_pic_full_url($feed_id)
{
echo "<script>console.log( 'Debug Objects: " . $feed_id . "' );</script>";
$ursls = 'https://graph.facebook.com/'.$feed_id.'/?fields=full_picture,picture&access_token="Access Tokken"';
$fb_act = json_decode(file_get_contents($ursls));
return $fb_act;
}
function get_facebook_page_feed($fts_limiter='')
{
if(!$fts_limiter)
{
$fts_limiter = 1;
}
$pageid = get_field('facebook_page_id','option');
//If there's no Access Token then use a default
$access_token_array = array(
'sampleaccess tokken'
'sampleaccess tokken'
'sampleaccess tokken'
);
$access_token = $access_token_array[rand(0, 11)];
$graph_data = 'https://graph.facebook.com/'.$pageid.'/posts?fields=id,from,message,story,story_tags,link,source,name,caption,description,type,status_type,object_id,attachments,created_time&access_token='.$access_token.'&limit=1&locale=en_US';
$fb_activity = json_decode(file_get_contents($graph_data));
return $fb_activity;
}
这用于获取和显示图像、标题和日期;
<div class="col-xs-12 col-sm-6 col-md-4 no-padding">
<div class="facebook_img">
<?php
$fb_feeds = get_facebook_page_feed();
if(!empty($fb_feeds)):
$feeds = $fb_feeds->data[0];
$created_time = $feeds->created_time;
$link = $feeds->link;
$feed_id = $feeds->id;
$full_arr = get_facebook_post_pic_full_url($feed_id);
$full_picture = $full_arr->full_picture;
$message = $feeds->message;
$submessage = substr($message,0,75);
?>
<!--<?php var_dump($full_arr);?> -->
<img style="width:405px;height:341px" src="<?php echo $full_picture; ?>" alt="facebook"/>
<div class="fb_content"> <a target="_blank" href="<?php echo $link; ?>"><?php echo $submessage; ?></a>
<dt><?php echo date('d/m/Y', strtotime($created_time)); ?></dt>
</div>
<?php endif; ?>
</div>
问题是我在 运行 时遇到此错误; $ursls = 'https://graph.facebook.com/'.$feed_id.'/?fields=full_picture,picture&access_token="Access Tokken"';
{
"error": {
"message": "(#100) Tried accessing nonexisting field (full_picture) on node type (Page)",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "traceid"
}
}
代码和一切工作正常,2 个月前就停止了。谁能告诉我为什么 full_picture 是不存在的字段?这是否意味着我们不能再为页面使用 full_picture 参数?任何帮助表示赞赏! :)
代码和一切工作正常,facebook 没有更改上述 post 中使用的任何参数。我的访问令牌有一些问题,我生成了一个新的,现在它开始工作了。谢谢!
我正在使用图表 API 获取访问令牌,使用参考 "pagename?fields=picture" 为我的 facebook 页面在我的网站上使用。 这是我正在使用的功能;
function get_facebook_post_pic_full_url($feed_id)
{
echo "<script>console.log( 'Debug Objects: " . $feed_id . "' );</script>";
$ursls = 'https://graph.facebook.com/'.$feed_id.'/?fields=full_picture,picture&access_token="Access Tokken"';
$fb_act = json_decode(file_get_contents($ursls));
return $fb_act;
}
function get_facebook_page_feed($fts_limiter='')
{
if(!$fts_limiter)
{
$fts_limiter = 1;
}
$pageid = get_field('facebook_page_id','option');
//If there's no Access Token then use a default
$access_token_array = array(
'sampleaccess tokken'
'sampleaccess tokken'
'sampleaccess tokken'
);
$access_token = $access_token_array[rand(0, 11)];
$graph_data = 'https://graph.facebook.com/'.$pageid.'/posts?fields=id,from,message,story,story_tags,link,source,name,caption,description,type,status_type,object_id,attachments,created_time&access_token='.$access_token.'&limit=1&locale=en_US';
$fb_activity = json_decode(file_get_contents($graph_data));
return $fb_activity;
}
这用于获取和显示图像、标题和日期;
<div class="col-xs-12 col-sm-6 col-md-4 no-padding">
<div class="facebook_img">
<?php
$fb_feeds = get_facebook_page_feed();
if(!empty($fb_feeds)):
$feeds = $fb_feeds->data[0];
$created_time = $feeds->created_time;
$link = $feeds->link;
$feed_id = $feeds->id;
$full_arr = get_facebook_post_pic_full_url($feed_id);
$full_picture = $full_arr->full_picture;
$message = $feeds->message;
$submessage = substr($message,0,75);
?>
<!--<?php var_dump($full_arr);?> -->
<img style="width:405px;height:341px" src="<?php echo $full_picture; ?>" alt="facebook"/>
<div class="fb_content"> <a target="_blank" href="<?php echo $link; ?>"><?php echo $submessage; ?></a>
<dt><?php echo date('d/m/Y', strtotime($created_time)); ?></dt>
</div>
<?php endif; ?>
</div>
问题是我在 运行 时遇到此错误; $ursls = 'https://graph.facebook.com/'.$feed_id.'/?fields=full_picture,picture&access_token="Access Tokken"';
{
"error": {
"message": "(#100) Tried accessing nonexisting field (full_picture) on node type (Page)",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "traceid"
}
}
代码和一切工作正常,2 个月前就停止了。谁能告诉我为什么 full_picture 是不存在的字段?这是否意味着我们不能再为页面使用 full_picture 参数?任何帮助表示赞赏! :)
代码和一切工作正常,facebook 没有更改上述 post 中使用的任何参数。我的访问令牌有一些问题,我生成了一个新的,现在它开始工作了。谢谢!