如何通过单个用户发布Facebook用户墙/页面状态只有其他用户没有安装应用程序 [英] how to post facebook user wall/ page status by a single user only no app install for other users

查看:206
本文介绍了如何通过单个用户发布Facebook用户墙/页面状态只有其他用户没有安装应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个网站上工作,我需要将该网站的页面链接发布到专门的用户墙或页面,如果发布了某些内容,这意味着我只需要一个用户来发布该问题。



我所面临的问题是访问令牌,因为我不想在网站流量前显示Facebook登录页面。它不喜欢在用户墙上共享,我们基本上试图在页面上自动发布状态,所以任何帮助这个问题将不胜感激。



我正在使用以下代码只要页面的访问令牌有效,但是我需要使一些永久性的东西,就可以将所有的信息添加到硬编码的php代码中,并且工作几个星期,至少不改变api密钥或令牌

  $ appid ='code'; 
$ appsecret ='code';
$ wall = $ pageId ='code';

$ token ='页面令牌';

$ facebook = new Facebook(array('appId'=> $ appid,'secret'=> $ appsecret,'cookie'=> true));

$ params = array('message'=> $ msg,'name'=> $ title,'caption'=> $ title,'link'=> $ uri, description'=> $ desc,'picture'=> $ pic,'access_token'=> $ token,'actions'=> json_encode(array('name'=> $ action_name,'link'=> ; $ action_link)));

$ result = $ facebook-> api($ wall。'/ feed /','post',$ params);

如果我从图形API进行令牌调试页面,那么它的工作正常,但一段时间后,我得到消息OAuthException:必须使用活动的访问令牌来查询有关当前用户的信息。



我真的很想找到一些坚实的东西。

谢谢

解决方案

你可以写一个后端脚本FB PHP-SDK),作为特殊用户运行并进行所需的FB api调用。为此,您将需要使用长期访问令牌 ,需要每60天更新一次。您也可以尝试使用应用访问令牌,不过期,但也不支持所有FB发布和其他操作。


I am working on a site and i need to post page links from that site to a special user wall or page if something is published on it which means i only need one user to post that question.

the problem which i am facing is access token since i am not trying to show facebook login page in front of website traffic. its not like sharing on user wall we are basically trying to post status on a page automatically so any help for this problem will be appreciated.

i am using the following code which seems to work fine as long as the access token for the page is valid but i need to make something permanent so that i can add all the info in the php code hardcoded and it work for some weeks at-least without changing the api key or token

$appid = 'code';
$appsecret = 'code';
$wall= $pageId = 'code';

$token='page token';

$facebook = new Facebook(array('appId'  => $appid, 'secret' => $appsecret, 'cookie' => true));

$params=array( 'message' => $msg,'name' => $title, 'caption' => $title, 'link' =>$uri,'description' => $desc, 'picture' => $pic, 'access_token' => $token,'actions' => json_encode(array('name' => $action_name,'link' => $action_link)) );

$result = $facebook->api($wall.'/feed/','post',$params);

if i make token from the graph api debug page then it works fine but after some time i got the message "OAuthException: An active access token must be used to query information about the current user."

i am really desperate to find something solid for it.

thank you

解决方案

You can write a backend script (maybe a cron job using the FB PHP-SDK) that runs as the special user and makes the desired FB api calls. For this, you will want to use a long-lived access token, which needs to be renewed every 60 days. You might also try your FB api calls using an App Access Token, which do not expire but also do not support all FB publishing and other operations.

这篇关于如何通过单个用户发布Facebook用户墙/页面状态只有其他用户没有安装应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆