1

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?

Goo
  • 1,318
  • 1
  • 13
  • 31
user1488674
  • 13
  • 1
  • 1
  • 3
  • You can check this out : http://stackoverflow.com/questions/6028981/using-httpclient-and-httppost-in-android-with-post-parameters – Romin Jul 02 '12 at 09:22

1 Answers1

9

You have to differentiate a bit here:

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.

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.

Community
  • 1
  • 1
Jan Gerlinger
  • 7,361
  • 1
  • 44
  • 52
  • Helped me too, good to know that `HttpClient` is already available in Android. Can you tell whether it's supported on all API levels? – aditya_medhe Dec 30 '15 at 02:42
  • 1
    As of Android 6.0, [Apache's HttpClient is not supported anymore](https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-apache-http-client). – Jan Gerlinger Dec 30 '15 at 15:32