Facebook:通过 php 将图像和描述发布到墙上和页面相册中
我希望用户通过网站上的表单在 Facebook 页面上发布图像。 当他们通过 Facebook 登录该网站时,可以从计算机中选择图像。
一旦他们选择了图像,我希望将其发布到用户墙上,以及我作为管理员之一的页面相册中。
我为此创建了一个应用程序,但我们似乎找不到一种方法让该应用程序在此 Facebook 页面上发布。
我们需要在此页面或应用程序上设置任何权限吗?
I want users to post an image on a facebook page via a form on a website.
When they have logged in via facebook on this website, they can select an image from their computer.
Once they have selected the image, I want it to be posted to the users wall, and in an album of the page where I'm one of the administrators.
I have created an app for this, but we can't seem to find a way to get the app to post on this facebook-page.
Do we need to set any permissions on this page or app?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要将图像上传到您作为管理员的 Facebook 页面,您需要执行以下操作:
1.) 创建一个 Facebook 应用程序(通常的方式),确保指定 Canvas URL
2.) 导航到下面记录的 URL作为页面的管理员,并授予权限(user_photos、manage_pages、offline_access、publish_stream)
3.)当您向应用程序授予所需的权限时,您将被重定向到canvas_url#access_token=*access_token*,例如
4。)然后导航到
(使用 #3 中的访问令牌)。这将列出您管理的页面;写下您想要上传图像的页面的 access_token
我不是 100% 确定,但我相信使用 graph api 您只能将图像上传到通过 graph api 创建的相册;即您需要首先通过 graph api 创建一个相册。以下是使用curl的示例代码:
上面的
$data
将包含相册ID,您需要上传照片:To upload images to a facebook page of which you're an admin you need to do the following:
1.) Create a facebook application (the usual way), make sure you specify the Canvas URL
2.) Navigate to the url below logged in as the admin of the page, and give the permissions (user_photos,manage_pages,offline_access,publish_stream)
3.) When you give the application the required permissions you'll be redirected to canvas_url#access_token=*access_token*, for example
4.) Then navigate to
(use the access token from #3). This will list the pages you administer; write down the access_token for the page(s) to which you want to upload the image
I'm not 100% sure but I believe that using graph api you can upload images only to albums created via graph api; i.e. you need to first create an album via graph api. Here's sample code using curl:
The
$data
above will contain the album id, which you'll need to upload a photo: