Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8515379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:07:51+00:00 2026-06-11T05:07:51+00:00

i am trying to post data via HTTP Post using name value key pair.

  • 0

i am trying to post data via HTTP Post using name value key pair. But I am unable to post . The post url is http://mastercp.openweb.co.za/api/dbg_dump.asp .Should I include some header also while posting? Thanks

public class MainActivity extends Activity {
    Button ok;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.profile);
        ok=(Button)findViewById(R.id.but_signup_login);



        ok.setOnClickListener(new OnClickListener() {


            public void onClick(View arg0) {


                System.out.println("Clicked");
        DownloadWebPageTask task = new DownloadWebPageTask();
        task.execute(new String[] { "http://mastercp.openweb.co.za/api/dbg_dump.asp" });}});
    }






    public void postData() {
        // Create a new HttpClient and Post Header
        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost("http://mastercp.openweb.co.za/api/dbg_dump.asp");

        System.out.println("Clicked again");
        try {
            // Add your data
            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(34);
            String amount ="Ashish";
            nameValuePairs.add(new BasicNameValuePair("User_Type", amount));
            nameValuePairs.add(new BasicNameValuePair("User_Email", "ash@gmail.com"));
            nameValuePairs.add(new BasicNameValuePair("User_Email_In", amount));
            nameValuePairs.add(new BasicNameValuePair("User_Pass", amount));
            nameValuePairs.add(new BasicNameValuePair("User_Mobile", amount));
            nameValuePairs.add(new BasicNameValuePair("User_Mobile_In", amount));
            nameValuePairs.add(new BasicNameValuePair("User_ADSL", amount));
            nameValuePairs.add(new BasicNameValuePair("User_Org", amount));
            nameValuePairs.add(new BasicNameValuePair("User_VAT", amount));
            nameValuePairs.add(new BasicNameValuePair("User_Name", amount));
            nameValuePairs.add(new BasicNameValuePair("User_Surname", amount));
            nameValuePairs.add(new BasicNameValuePair("User_RegNo", amount));
            nameValuePairs.add(new BasicNameValuePair("User_Address", amount));
            nameValuePairs.add(new BasicNameValuePair("User_Town", amount));
            nameValuePairs.add(new BasicNameValuePair("User_Code", amount));
            nameValuePairs.add(new BasicNameValuePair("User_State", amount));
            nameValuePairs.add(new BasicNameValuePair("User_Country", amount));
            nameValuePairs.add(new BasicNameValuePair("User_ADSL", amount));
            nameValuePairs.add(new BasicNameValuePair("User_ADSL_Address", amount));
            nameValuePairs.add(new BasicNameValuePair("Payment_CC_Alt", amount));
            nameValuePairs.add(new BasicNameValuePair("Payment_Type", amount));
             nameValuePairs.add(new BasicNameValuePair("CProfile", amount));
            nameValuePairs.add(new BasicNameValuePair("COrder", amount));
            nameValuePairs.add(new BasicNameValuePair("Debit_Name", amount));
            nameValuePairs.add(new BasicNameValuePair("Debit_Bank", amount));
            nameValuePairs.add(new BasicNameValuePair("Debit_Number", amount));
            nameValuePairs.add(new BasicNameValuePair("Debit_Code", amount));
            nameValuePairs.add(new BasicNameValuePair("Debit_Type", amount));
            nameValuePairs.add(new BasicNameValuePair("TOS_Agree", amount));  
            nameValuePairs.add(new BasicNameValuePair("Code", amount));  
            nameValuePairs.add(new BasicNameValuePair("package_activation", amount));  
            nameValuePairs.add(new BasicNameValuePair("session", amount)); 
            nameValuePairs.add(new BasicNameValuePair("OnceOff", amount));  
            nameValuePairs.add(new BasicNameValuePair("submit-button", amount));  


            try {
                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
            } catch (UnsupportedEncodingException e) {
               System.out.println("Unsupported Exception "+e);
                e.printStackTrace();
            }

        }  catch (Exception e) {
            System.out.println("  Exception last"+e);
            // TODO Auto-generated catch block
        }
    } 




    private class DownloadWebPageTask extends AsyncTask<String, Void, String> {
        @Override
        protected String doInBackground(String... urls) {
          String response = "";
          for (String url : urls) {


             postData(); 
          }


        return response;
      }
        @Override
        protected void onPostExecute(String result) {}
}


} 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T05:07:53+00:00Added an answer on June 11, 2026 at 5:07 am

    Your postdata() method doesn’t actually do the post. You need to do something like:

    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
    HttpResponse response = httpclient.execute(httppost, new BasicHttpContext());
    

    Then you can process the response (starting by checking the value of response.getStatusLine().getStatusCode()). For instance, if you’re expecting string data in the response:

    if (response.getStatusLine().getStatusCode() == 200) {
        BasicResponseHandler handler = new BasicResponseHandler();
        String data = handler.handleResponse(response);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get page data using cURL and sending variables via POST. Here's
I am trying to post some data with jQuery Ajax, but the parameters in
While trying to send a POST request via xmlhttp.open(POST, url, true) (javascript) to the
I am trying to post a file to a URL via the MS-DOS command
I'm trying to create a form using method=post . When it's submitted, the data
I am trying to post data from PHP to Server which is built in
I'm trying to POST data from an iOS app to Node.js/Express. I cannot get
Trying to post JSON data to Spring controller.. Not working at all JSP Code:
I'm trying to read POST data in a PHP script. My first instincts led
I'm trying to send post data between pages with Post. Not a form -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.