hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From IerfSaibot <tobiasf...@gmx.de>
Subject HttpPost and parameters
Date Mon, 26 Oct 2009 22:13:24 GMT

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
-- 
View this message in context: http://www.nabble.com/HttpPost-and-parameters-tp26068695p26068695.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
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