问题描述
我正在写一个应用程序,将与网站进行互动。在该网站的身份验证是低谷AJAX POST request.How我可以在Android应用程序执行这一要求?
I'm writing an app that will interact with site. In that site authentication is trough AJAX POST request.How can i execute that request in my Android app?
推荐答案
您必须在这里区分一下:
You have to differentiate a bit here:
AJAX 仅仅是从客户端发起技术浏览器到该网站。在你的情况,你想从你的Java应用程序发送的 HTTP POST请求
AJAX is only the technology that initiates an HTTP Post Request from the Client Browser to the website. In your case, you want to send that HTTP Post Request from your Java application.
首先,你必须找出哪些URL请求,什么键 - 值对的这项要求,您可以通过分析AJAX code或通过使用一些浏览器插件或的向您展示了原始的POST请求。然后,您可以填写例如该请求Apache的的HttpClient
(已在Android SDK中提供)。为了找出如何做到这一点,看看。
First you have to find out which URL is requested and what key-value-pairs are send within that request, which you can do by analyzing the AJAX code or by using some browser plugin or Wireshark to show you the raw POST request. Then you can submit that request using e.g. Apache's HttpClient
(already available in the Android SDK). For finding out how to do that, take a look at this answer.
这篇关于发送一个AJAX POST请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!