使用 API 获取 Facebook 照片的安全浏览方法
使用facebook graph您可以获取照片信息如下: https://graph.facebook.com/20531316728
然而,他们提供的实际抓取照片的链接并不是安全并使用 http: http://profile.ak.fbcdn.net/hprofile-ak-snc4/174597_20531316728_2866555_s.jpg
用 https 替换 http 并不能解决问题,因为您会收到安全警告: https://profile.ak.fbcdn.net/hprofile-ak-snc4/174597_20531316728_2866555_s.jpg
Facebook 坚持要求所有应用程序都使用安全浏览并使用 https。然而,我的应用程序使用 Facebook 照片,无法访问,因为它们以 http 开头。
有谁知道如何解决这个问题?
Using the facebook graph you can get photo information as follows:
https://graph.facebook.com/20531316728
However the link they provide to actually grab the photos are not secure and use http:
http://profile.ak.fbcdn.net/hprofile-ak-snc4/174597_20531316728_2866555_s.jpg
Replacing http with https doesn't do the trick because you get a security warning:
https://profile.ak.fbcdn.net/hprofile-ak-snc4/174597_20531316728_2866555_s.jpg
Facebook is insisting that all apps use secure browsing and use https. However my app uses facebook photos, which cannot be accessed because they begin with http.
Does anyone know how to get around this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我找到了我自己问题的答案。您可以添加一个参数来获取 ssl 参数:
https://graph.facebook.com/20531316728& ;return_ssl_resources=1
I found the answer to my own question. You can add a parameter to get a the ssl parameter:
https://graph.facebook.com/20531316728&return_ssl_resources=1
除了个人资料图片之外,我从未遇到过向 API 请求图像的有效 https 版本的方法。这是由
https://graph.facebook.com/{userId/Name}/picture
完成的,这是 Zuck:https://graph.facebook.com/4/picture 和 https ://graph.facebook.com/zuck/picture
I've never come across a way to ask the API for valid https versions of the images other than for profile pictures. That is done by
https://graph.facebook.com/{userId/Name}/picture
Here's Zuck: https://graph.facebook.com/4/picture and https://graph.facebook.com/zuck/picture
如果您使用 PHP SDK,这真是一个救星(其中 $album['cover_photo'] 是照片的 id):
每当我只需将 &return_ssl_resources=1 添加到末尾时查询本身我的服务器会抛出 500 错误。我发现另一个线程表明您可以在数组中传递这个参数。
If you're using the PHP SDK, this was a F***ing life-saver (where $album['cover_photo'] is the id of a photo):
Whenever i would simply add &return_ssl_resources=1 to the end of the query itself my server would throw a 500 error. I found another thread that showed that you can pass this argument in an array.