-1

I want to run a cURL command into my android application but I don't know how. This is the example command:

curl --data "mail=abc@abc.com&pass=azerty" http://www.website.com/login/
Sergey
  • 7,985
  • 4
  • 48
  • 80
Ghassen Khelif
  • 151
  • 2
  • 9

2 Answers2

0

You can achive this using android NDK, here is a nice article to achive this task

Arsal Imam
  • 2,882
  • 2
  • 24
  • 35
0

Thank you all I found this solution :

new Thread(new Runnable() {

            @Override
            public void run() {
                final HttpParams params = new BasicHttpParams();
                HttpClientParams.setRedirecting(params, true);
                HttpClient httpclient = new DefaultHttpClient();

                HttpPost httppost = new HttpPost(
                        "http://wwwebsite.com/login/");
                String HTML = "";
                try {
                    List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(
                            3);
                    nameValuePairs.add(new BasicNameValuePair("mail","abc@abc.tn"));
                    nameValuePairs.add(new BasicNameValuePair("pass", "azerty"));
                    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

                    HttpResponse response = httpclient.execute(httppost);

                    HTML = EntityUtils.toString(response.getEntity());
                    if (response.getEntity() != null) {
                        Log.i("RESPONSE", HTML.toString());
                    }

                } catch (ClientProtocolException e) {
                    Log.e("ee","ee");
                } catch (IOException e) {
                    Log.e("ee","ee");

                }

            }
        }).start();
Ghassen Khelif
  • 151
  • 2
  • 9