|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
HttpPost and parametersHi,
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 |
|
|
Re: HttpPost and parametersIerfSaibot 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@... For additional commands, e-mail: httpclient-users-help@... |
| Free embeddable forum powered by Nabble | Forum Help |