发布到Facebook公司页面与cron php服务器端 [英] Posting to facebook company page with cron php server side

查看:232
本文介绍了发布到Facebook公司页面与cron php服务器端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想直接使用cron和php来更新Facebook公司页面。

I am looking to update a facebook company page directly using cron and php.

任何人都可以了解最简单的当前正确的生成页面访问令牌的正确方法

Can anyone shed some light on the simplest current correct method of generating a page access token then extending that so that I may use that in my php script that I will run by cron?

我只想写两个简单的php脚本,一个生成这个扩展页面令牌通过我在浏览器每月打开该页面,另一个将由cron使用该页面令牌执行自动身份验证独立于用户浏览器(我想我的服务器进行身份验证)发布简单的文本消息我是管理员的公司页面。

I just want to write two simple php scripts, one that generates this extended page token by me opening that page within a browser monthly, and the other which would be executed by cron using that page token for automatic authentication independent of a users browser (I want my server to authenticate by itself) to post a simple text message to a company page that I am an admin of.

我只是想在特定时间发送短消息到公司页面直接从服务器,没有人必须

I am just looking to send short messages at particular times to the company page direct from the server without a person having to be involved.

感谢

推荐答案

发布到贵公司的信息页,那么您需要页面访问令牌,并且巧合的是它永远不会过期。

First of all, as you need to post to your company's Page, then you would require Page Access Token and coincidentally it never expires onece generated.


  1. 首先,您必须实现Facebook的 login 功能以及扩展权限 manage_pages 权限。最简单和最快的方法是创建一个应用程序,然后在选择的应用程序中使用图形资源管理器,使用 manage_pages 权限生成访问令牌。如果您想实现相同的功能,您可能需要查看此 example
    修改:使用图表管理器时,您需要导航到 / me / accounts 端点,

  1. First you will have to implement login feature of Facebook along with extended permission manage_pages permission. The easiest and fastest way to do the same would be to create an App and then using Graph Explorer with the app selected, generate access token with the manage_pages permission. If you want to implement the same you might want to look at this example. When using Graph Explorer you would be required to navigate to /me/accounts end point, there you would find the required access token for the page in question along with other pages you might administer.

您获得页面访问令牌后,您可以使用该访问令牌来执行使用 PHP SDK 发布更新 api SDK中的网页与 setAccessToken() 。或者您可以使用消息在端点处的页面执行HTTP POST

After you have obtained the Page Access Token, you may then use the same to perform the posting of update using the PHP SDK's api method after you have set the access token of your Page in the SDK with setAccessToken(). Or you may just perform a HTTP POST with your message to your page at the endpoint

https://graph.facebook.com/pageID/feed?access_token=Your_page_access_token

这篇关于发布到Facebook公司页面与cron php服务器端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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