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

  • Home
  • SEARCH
  • 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 rewrite some server php code which logs into a website,
I'm trying to write a blog post which includes a code segment inside a
I'm trying to write a bzr post-commit hook for my private bugtracker, but I'm
I am trying to tidy up some legacy code. The following is a cut
I am trying to POST a HTML (contained in a file) to a URL
I'm trying to POST to the HTTP gateway of an SMS provider (Sybase 365)
I am trying to post an array full of checkboxes and to open it
Hi i am encountering problems trying to post a WebRequest under Https. i received
From an earlier post about trying to improve my sites performance I have been
Trying to answer to another post whose solution deals with IP addresses and netmasks,

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.