Hi All,
I need to bypass internal proxy firewall to connect to the
internet. I have no problem connecting to the internet with the following
code.
DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.getCredentialsProvider().setCredentials(
new AuthScope("172.31.100.14", 3128), new
UsernamePasswordCredentials("user", "pass"));
HttpHost targetHost = new HttpHost("www.somesite.org");
HttpHost proxy = new HttpHost("172.31.100.14", 3128);
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
proxy);
HttpGet httpget = new HttpGet("/");
HttpResponse response = httpclient.execute(targetHost, httpget);
HttpEntity entity = response.getEntity();
System.out.println(response.getStatusLine());
Status code: *Http/1.0 200 OK*. It seems it is connecting to the target
host.
another URI on the same site takes a parameter query and has both the get
and post implementations
www.somesite.org/books?query=somequery
I need to execute the uri above. I need to pass the query both in get and
post methods. How do I set the parameters to pass this query parameter.
Please help me.
--
Phani. S
M.Tech(Software Engineering)
Motilal Nehru National Institute of Technology
(+91) 9010093398