读取外部 HTTPS 站点的 JSON feed
是否可以读取另一个 HTTPS 站点中可用的 JSON 提要? 我得到空字符串作为回报。
Is it possible to read JSON feed available in another site which is HTTPS?
I'm getting empty string in return.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只要您遵守同源政策,这是可能的。对于跨域 AJAX,您可以使用 JSON/P 或者如果您不这样做无法控制远程域,并且它不会公开您可能需要在域上设置服务器端脚本的
JSON/P
数据,该脚本将充当两个域之间的桥梁。It is possible as long as you respect the same origin policy. For cross domain AJAX you could use JSON/P or if you don't have control over the distant domain and it doesn't expose a
JSON/P
data you might need to setup a server side script on your domain that will act as a bridge between both domains.您还想查看 CORS
http://hacks.mozilla .org/2009/07/cross-site-xmlhttprequest-with-cors/
You also want to check out CORS
http://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/