VB.NET 使用 Graph API 将照片上传到 Facebook
寻找一些代码来使用 VB.NET 中的 Graph API 将照片上传到 Facebook。我有 Facebook C# SDK,但据我所知,它不支持上传照片。
访问照片效果很好,我也可以将其他内容发送到 Facebook。只是不是照片。
facebook 文档讨论了将文件作为表单多部分请求附加,但我不知道该怎么做。说它没有很好的记录是轻描淡写的。即使是我雇来做这种事情的人也无法让它发挥作用。
我发现了这个:使用 Facebook 的 Graph API 将照片上传到相册,但它只描述了如何在 PHP 中执行此操作。
我还看到来自不同站点的关于将照片的 URL 作为 HTTP 请求的一部分传递的不同方法,但在多次尝试本地或远程 URL 后,我不断收到错误的 url 错误或类似的错误。
有什么想法吗?
Looking for some code to upload a photo to facebook using the Graph API in VB.NET. I have the Facebook C# SDK, but it doesn't support uploading photos as far as I can tell.
Accessing the photos works fine and I can send other content to Facebook fine as well. Just not photos.
The facebook documentation talks about attaching the file as a form-multipart request, but I have no idea how to do that. To say that its not very well documented is to put it lightly. Even the guys I hire to do this kind of thing couldn't get it to work.
I've found this: Upload Photo To Album with Facebook's Graph API, but it only describes how to do it in PHP.
I've also seen varying method from different sites about passing the URL of the photo as a part of the HTTP request, but after trying local or remote URLs several times I kept getting a bad url error or something like that.
Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要将 POST 请求中的图像传递给 Graph API(需要publish_stream 权限)。 Facebook 文档中提到的内容是正确的。以下是可以完成这项工作的示例代码。在方法内部使用它。 (代码为 C#)
图例
:您需要提供信息。更新
请发表评论以改进代码。
You need to pass the Image in a POST request to the Graph API (Need publish_stream permission). What is mentioned in Facebook Documentation is correct. Following is the example code that may do the work. use it inside a method. (Code is in C#)
Legend
<content>
: you need to provide the info.Update
Please post comments to improve the code.