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 3982230
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:30:13+00:00 2026-05-20T05:30:13+00:00

I am trying to POST some parameters to a server, but I need to

  • 0

I am trying to POST some parameters to a server, but I need to set up the proxy. can you help me to to sort it “setting the proxy” part of my code ?

HttpHost proxy = new HttpHost("xx.x.x.xx");

DefaultHttpClient httpclient = new DefaultHttpClient();

httpclient.getParams().setParameter("3128",proxy);


HttpPost httpost = new HttpPost(url);
List<NameValuePair> nvps = new ArrayList<NameValuePair>();

nvps.add(new BasicNameValuePair("aranan", song));

httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));

HttpResponse response = httpclient.execute(httpost);
HttpEntity entity = response.getEntity();
System.out.println("Request Handled?: " + response.getStatusLine());

in = entity.getContent();

httpclient.getConnectionManager().shutdown();
  • 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-05-20T05:30:13+00:00Added an answer on May 20, 2026 at 5:30 am

    Yes I sorted out my own problem,this line

    httpclient.getParams().setParameter("3128",proxy);
    

    should be

    httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,proxy);
    

    Complete Example of a Apache HttpClient 4.1, setting proxy can be found below

    HttpHost proxy = new HttpHost("ip address",port number);
    DefaultHttpClient httpclient = new DefaultHttpClient();
    httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,proxy);
    
    HttpPost httpost = new HttpPost(url);
    List<NameValuePair> nvps = new ArrayList<NameValuePair>();
    nvps.add(new BasicNameValuePair("param name", param));
    httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.ISO_8859_1));
    HttpResponse response = httpclient.execute(httpost);
    
    HttpEntity entity = response.getEntity();
    System.out.println("Request Handled?: " + response.getStatusLine());
    InputStream in = entity.getContent();
    httpclient.getConnectionManager().shutdown();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to post some data with jQuery Ajax, but the parameters in
I'm trying to do a request to a server with some POST parameters, I
I am trying to post some java code snippets on wordpress.com using the following
I am trying to get some form data from POST method. Here's the code
I'm trying to get pre/post annotations working with a web application, but for some
Trying to post information for nested parameters to a rails app and having some
I am trying to rewrite some server php code which logs into a website,
Hi i need to post some data to a web server from windows phone
I trying to send two parameters to some server. the server is responding to
Using $.getJSON(); or $.post(); I'm trying to send some parameters through a page that

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.