This will do the trick
===================================
HttpClient agent = new HttpClient();
PostMethod httppost = new PostMethod(
"http://www.amfiindia.com/navreport.asp");
httppost.setRequestBody(new NameValuePair[] {
new NameValuePair("cmbmf", "36"),
new NameValuePair("btnview", "View")});
try {
agent.executeMethod(httppost);
System.out.println(httppost.getStatusLine());
System.out.println(httppost.getResponseBodyAsString());
} finally {
httppost.releaseConnection();
}
====================================
where "cmbmf" is the mutual fund id
Hope this helps
Oleg
On Mon, 2004-09-13 at 14:13, Spam Proof wrote:
> Hi,
>
> I am using httpclient to post some data to a website.
>
> The actual url that I am trying to post to is http://www.amfiindia.com/navreport.asp
>
> The asp page corresponding to the form is given below
>
> -------navreport.asp------begin--------
> <form name="abc" method="post" action="navreport.asp">
> <select size="1" name="cmbmf">
> <option value="all">ALL</option>
> <option value=39>abc</option>
> ...
> </select>
> <input type="submit" value="View" name="abcv" onclick="location.replace('#123')">
> -------navreport.asp------end----------
>
> I use the following code:
>
> String url = "http://www.amfiindia.com/navreport.asp";
>
> HttpClient client = new HttpClient();
>
> PostMethod method = new PostMethod( url );
>
> method.addParameter( "cmbmf", "all" );
>
>
>
> method.setFollowRedirects(true);
>
> int statusCode = client.executeMethod( method );
>
> if( statusCode != -1 ) {
>
> String contents = method.getResponseBodyAsString();
>
> method.releaseConnection();
>
> System.out.println( contents );
>
> }
>
> Instead of the posted results, I am getting the page containing the form. Should I
> use a different url because of the onclick="location.replace('#123')" in the submit
> button?
>
>
> Yahoo! India Matrimony: Find your life partneronline.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]