如何使用Facebook PHP API将照片上传到没有文件POST的墙壁? (使用URL可能吗?) [英] How to use Facebook PHP API to upload a photo to wall without file POST? (Using a URL maybe?)

查看:165
本文介绍了如何使用Facebook PHP API将照片上传到没有文件POST的墙壁? (使用URL可能吗?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为即将到来的项目进行初步研究。基本上是用户/数据流:




  • 事件中的网络摄像头拍照并将照片发送到本地服务器


  • 品牌代理拥有一个带有应用程序的iPad(开发为HTML应用程序作为应用程序保存到iPad主屏幕)。该应用程序通过简单的AJAX调用将本地服务器上的所有照片显示为缩略图,将其加载到视图中。


  • 用户选择一张照片。该照片将从本地服务器发送到我们的远程服务器。远程服务器将使用用户选择的照片来托管Facebook iFrame选项卡。


  • 同时,具有查询字符串的iFrame选项卡的链接将为张贴在用户的Facebook墙和Twitter上(如果他们选择认证当然)。




现在是棘手的部分,我们有99%的确定,客户端也想要将照片直接上传到Facebook用户的相册。可能也是TwitPic,但这是次要关注。所以我的问题是,有没有办法使用PHP上传照片到Facebook的墙壁,而不使用典型的html文件输入字段和POST?理想情况下,如果我们可以在本地服务器上的照片URL上执行某种file_get_contents,并使用PHP / FB API上传照片URL的内容,那么我们将会很好。



目标是将照片上传到用户墙,其标题如下所示:


查看我的照片在 _ 事件发生!



解决方案

@jeremyharris是正确的说Facebook的PHP SDK包装cURL。您确实需要使用cURL向Facebook的API端点发送请求。虽然,首先阅读 http://developers.facebook.com/docs/reference/api/ 发布部分,以了解机制,然后再跳转到 SDK



然后熟悉 Feed对象。您可以使用它或照片对象上传照片。


I'm doing preliminary research for an upcoming project. Basically here is the user/data flow:

  • A webcam at an event takes pictures and sends the photos to a local server

  • A brand rep has an iPad with an app (developed as an HTML app saved to iPad home screen as an app). The app displays all photos from the local server as thumbnails via simple AJAX calls to load them into the view.

  • A user selects a photo. That photo will be sent from our local server to our remote server. The remote server will host a Facebook iFrame tab with the user selected photos.

  • At the same time, a link to the iFrame tab with a query string will be posted on the user's Facebook wall and Twitter (if they choose to authenticate of course).

Now the tricky part, we are 99% sure that the client is going to want to also upload the photo directly to the Facebook user's album. Possibly to TwitPic as well but that is a secondary concern. So my question is, is there a way to use PHP to upload a photo to a Facebook wall without using a typical html file input field and POST? Ideally, if we can do some kind of a file_get_contents on the photo URL from the local server and use PHP/FB API to upload the contents of the photo URL, we'd be in great shape.

The goal is to have the photo uploaded to the user wall with a caption like:

Check out my photo taken at _ event! [URL to client facebook tab with photo id].

解决方案

@jeremyharris is right to say that Facebook's PHP SDK wraps cURL. You indeed need to use cURL to post a request to Facebook's API endpoint. Though, start by reading http://developers.facebook.com/docs/reference/api/ Publishing section to understand the mechanics before you jump onto their SDK.

Then familiarise with the feed object. You can use either it or the photo object to upload the photo.

这篇关于如何使用Facebook PHP API将照片上传到没有文件POST的墙壁? (使用URL可能吗?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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