commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jaap" <>
Subject HttpClient cannot post Form like IE and Mozilla
Date Sun, 12 Sep 2004 19:31:11 GMT

Sometimes I find a website that gives an unexpected response. Usually I drop
HttpClient for the basic approach, but this time that did not work
too! Somehow HttpClient posts a form different than IE and Mozilla. How
exactly i do not know - but maybe I am just doing something wrong in these
particular cases.

Below is an example of a website that works in IE/Mozilla, but it does not
in HttpClient

Copy paste this simple HTML to a local html file and execute it:

<form action="" method="post">
<input name="soortpand" value="0"/><input name="prijsklasse"
value="0"><input value="Search" type="submit">

You will see a list of houses will be returned by the (
- if you change post into get - no results are returned (actually most
webservers don't care about that).
- cookies and referer are of no influence to this webserver's behaviour (i
tried that already).

If you run HttpClient on this - the webserver will return something
completely different.
Try this in you favorite IDE

HttpConnection httpCon = new HttpConnection("", 80);
HttpMethodBase http = new PostMethod();
NameValuePair nvp[] = new NameValuePair[2];
nvp[0] = new NameValuePair();
nvp[1] = new NameValuePair();
HttpState state = new HttpState();
http.execute(state, httpCon);

Has anybody a suggestion how i can get this to work?

(For those who have trouble reading Dutch... The expected response is a list
of properties, but with HttpClient the response is: 'Cannot find any



jaap - yawi
amsterdam science park
kruislaan 402
1098 sm amsterdam
the netherlands
m: +31 6 4540 2828
t: +31 20 888 4836
f: +31 20 888 4838

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message