Acessing从Android的应用程序的Web [英] Acessing the web from android application

查看:227
本文介绍了Acessing从Android的应用程序的Web的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这心不是具体一个编程问题,更多的逻辑。

This isnt specifically a programming question, more on the logic.

基本上我有一个网站,我想提出一个Android应用程序。在应用程序,我希望用户可以通过输入自己的用户名和密码的应用程序的提示登录。当用户点击登录数据被发布到网站的网址。
这是我有点失去了...怎么那么应用程序知道登录是否成功与否,并且,如果成功了,我想该应用显示那么另一种形式或任何用户能够发布新作内容的网站,这将在再次公布。我想像这涉及检索一个cookie来检查验证?我将不得不设置自定义响应页面?和应用程序将如何维护会话?

Basically I have a website which I am making an android app for. On the app I want the user to be able to login by entering their username and password to the prompt on the app. When the user clicks login the data is POSTED to the site URL. This is where I am a bit lost... how then does the app know whether the login was successful or not, and, if successful, I want the app to show then another form or whatever for the user to be able to post new content to the site, which will be POSTED again. I'd imagine this involves retrieving a cookie to check for authentication? Would I have to set up a custom response page? And how would the app maintain the session?

推荐答案

要回答你的问题:

怎么那么应用程序知道登录是否成功?

how then does the app know whether the login was successful or not?

在服务器端,可以应对 POST 用值命令。这个值可以是任何你想要的,包括登录是否成功与否的信息。

On server side, you can RESPOND to the POST command with a value. This value can be whatever you want, including information on whether the login was successful or not.

我想像这涉及检索一个cookie来检查验证?

I'd imagine this involves retrieving a cookie to check for authentication?

您可以用COOKIE来验证在该请求来自一个有效的会话服务器端。

You can use a COOKIE to validate on the server side that the request comes from a valid session.

我将不得不设置自定义响应页面?

Would I have to set up a custom response page?

这不是绝对必要的,但我肯定会做到这一点。

It's not strictly necessary, but I would definitely do this.

如何将应用程序维护会话?

how would the app maintain the session?

您可以存储的cookie在全球的对象/变量。

You can store the "cookie" on a global object/variable.

-

有回答你的问题,我建议你做一个小的RESTful / HTTP / SOAP API在服务器端,并使用该客户端(机器人)的一面。这将是比分析现有的网页更容易。

Having answer your questions I would suggest you do a small RestFUL/HTTP/SOAP API on the server side and use that on the client (ANDROID) side. It will be easier than PARSING existing web pages.

这篇关于Acessing从Android的应用程序的Web的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆