对没有 API 的网站进行 HTTPS 调用
我正在开发一个 wp7 应用程序,我想对一个没有 REST API 的网站进行 https 调用(登录然后发布)。因此,我必须像浏览器一样使用它,将标头添加到 https 登录调用并解析结果数据,获取 Cookie 数据和分配额外的唯一 ID,并将其传递给我进行的后续 https 调用。
有人可以指出我做到这一点的最佳方法吗?指向一些接近于此的示例的指针会很有帮助。
谢谢
I am working on a wp7 app and I want to make an https call (sign-in and then post ) to a website which does not have an REST API. So I will have to use it just like a browser adding headers to the https sign in call and parsing the resulting data get the Cookie data and unique id assigned extra and pass that on to a subsequent https calls I make.
Can someone please point me to best way to do this ? Pointers to some samples that comes close to this would be helpful.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果相关网站不阻止 CSRF,您只需向其提交表单数据即可直接地。如果是这样,您将需要屏幕抓取网站的表格,然后填充必要的文件,然后提交。
如果您可以控制该网站,从长远来看,您的情况可能会更好,并且不会受到网站更改的影响。
如果这不是您的网站,请务必检查网站所有者关于自动登录的许可。您还需要非常小心对用户登录凭据所做的操作。
If the site in question doesn't prevent CSRF you could just submit form data to it directly. If it does, you're going to need to screen scrape the forms for the website, then populate the necessary fileds and then submit.
If you have control over the site, you'll probably be better off in the long run and be less vulnerable to changes to the site.
If it's not your site, be sure to check permission from the site owner about automating logging in. You also need to be very careful about what you do with regard to the users login credentials.