如何在 https 中获取 facebook 个人资料图片的真实 url
我想知道是否有办法在 https 中获取 facebook 用户个人资料图像的真实 url。
就像我使用 https://graph.facebook.com/20926460/picture 获取个人资料图像,
它将重定向到 http://profile.ak.fbcdn.net /hprofile-ak-snc4/41539_20926460_5421452_q.jpg。
有没有办法获取第二个网址的“https”版本?或者该网址是否存在?
I am wondering if there is a way to get facebook user profile image's real url in https.
Like I use https://graph.facebook.com/20926460/picture to get a the profile image,
It will redirect to http://profile.ak.fbcdn.net/hprofile-ak-snc4/41539_20926460_5421452_q.jpg.
Is there a way to get the "https" version of the second url? or is the url existing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
自从您上次查看以来,文档中的情况可能已经发生了变化,我知道在窥探工具问世后每个人都对 https 感到兴奋。
“如果您需要通过安全连接返回图片,可以将 return_ssl_resources 参数设置为 1: https://graph.facebook.com/xx_userid_xx/picture?return_ssl_resources=1。"
希望这不会改变你的方向。
This might have changed in the docs since you last looked, I know everyone got excited about https after that snooping tool came out.
"If you need a picture to be returned over a secure connection, you can set the return_ssl_resources argument to 1: https://graph.facebook.com/xx_userid_xx/picture?return_ssl_resources=1."
Hopefully that won't redirect you.
2012 年 9 月 10 日更新
https://graph.facebook.com/20926460/picture 现在重定向到 https网址。
Update 10 sept 2012
https://graph.facebook.com/20926460/picture now redirects to https urls.
您可以将目标 URL 中的 http 替换为 https,但请记住,这只是暂时的,可能会超时。
也没有有效的 ssl 证书,但如果您忽略它,则会提供该文件。
如果您需要有效的经过认证的图片 https url,您需要在服务器上设置一个通过该文件的代理脚本。
编辑:
至于你的评论,这里是我所说的“代理脚本”的一个例子。
您可以将其放在您的服务器上并使用您喜欢的任何协议/方案来请求它。
就像是当地的照片一样。您可能应该验证 mime 类型。做一些错误处理并防止注入等,但只是为了给你一张图片:
仅供参考,我将 int 转换放在那里以防止注入黑客。
脚本未经测试,但应该可以工作,因为 file_get_contents 将遵循重定向。
You can just replace http by https in the target url but keep in mind that it is only temporary and may time out.
there is also no valid ssl certificate, but if you ignore that, the file will be served.
if you need a valid certified https url for pictures you need to set up a proxy script on your server that passes through the file.
edit:
as for your comment here is an example of what i meant by "proxy script".
you can put it on your server and request it with whatever protocl/scheme you like.
just like it was a local picture. you should probably validate the mime type. do some error handling and prevent injections etc. but just to give you ap icture:
fyi i put the int cast there to prevent injection hacking.
script is untested but should work as file_get_contents will follow redirects.