hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: HttpPost and parameters
Date Mon, 26 Oct 2009 22:49:51 GMT
IerfSaibot wrote:
> Hi,
> i like to simulate a login on a webpage via an httppost request. I try to
> setup the parameters via the following code:
> 
> .
> .
> .
>                 HttpPost httppost=new HttpPost(ggserverurl+phpexec);
> 		HttpResponse response;
> 		HttpEntity entity;
> 		BufferedReader bufferedreader;
> 
> 		List <NameValuePair> parameters = new ArrayList <NameValuePair>();
> 		parameters.add(new BasicNameValuePair("a", "a"));
> 		parameters.add(new BasicNameValuePair("b", "b"));
> 		parameters.add(new BasicNameValuePair("c", "c"));
> 		parameters.add(new BasicNameValuePair("d", "e"));
> 		parameters.add(new BasicNameValuePair("e", "f"));
> 		parameters.add(new BasicNameValuePair("f", "g"));
> 		try {
> 			//httppost.setParams(loginparams);
> 			UrlEncodedFormEntity sendentity = new UrlEncodedFormEntity(parameters,
> HTTP.UTF_8);
> 			httppost.setEntity(sendentity);
> 			response=httpclient.execute(httppost);
> 			entity=response.getEntity();
> 			/**if (entity!=null){
> 				bufferedreader=new BufferedReader(new InputStreamReader (new
> BufferedInputStream(entity.getContent())));
> 				int i;
> 				for(i=0;i<1000;i++)System.out.println(bufferedreader.readLine());
> 			}**/
> .
> .
> .
> 
> when i execute the request i am not able to see the parameter/value pairs
> within an http analyzer. In the header, content-length has a value of 23. In
> a tab "Post date" in the analyzing tool, i cannot see anything.
> 
> When firefox sends the request, everything is okay, the pairs are present.
> 
> Any ideas?
> 
> Greetings
> 
> Tobias

Try wirelog as described here

http://hc.apache.org/httpcomponents-client/logging.html

Oleg

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message