hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ernst Nolte <er...@synquad.nl>
Subject Re: responding to form login fields
Date Thu, 04 Mar 2010 13:45:02 GMT
Hi Jim

I assume you use HttpClient v4?

If you look at the form action attribute in the page you will see this:

<form action="login.asp" method="post" id="form1" name="form1">

So you need to post the parameters to this url:

http://www.gomeznetworks.com/login.asp
and set the fields  like this:
HttpPost post = new HttpPost(url);
List<NameValuePair> vals = new ArrayList<NameValuePair>();
vals.add(new BasicNameValuePair("username", "you"));
vals.add(new BasicNameValuePair("pwd", "passwd"));
post.setEntity(new UrlEncodedFormEntity(vals, HTTP.UTF_8));
and now execute it.

as far as the input type image is concerned, I think the onclick event  
of image is captured bij Javascript event attachment and in that  
handler the form is posted, but I did not bother to verify that.

Met Vriendelijke groet/Kind regards,

Ernst Nolte

Email: ernst@synquad.nl
Website: http://www.synquad.nl
Office: Zwarteweg 6-D, 1412GD, Naarden
Tel: +31(0)35 698 11 55
Fax: +31(0)35 698 27 42
Mob: +31(0)6 813 287 75

On 4 Mar 2010, at 13:55, Langston, James wrote:

> Hi all,
>
> After tons of look up - I haven't been able to find a good example of
> being able
> to correctly respond to a login form that is using an type="image"  to
> initiate the login
> process. The fields in the html are:
>
> <td>
> 	
> Username:<br>
> 						            <input
> type="text" size="30" maxlength="60" name="username"><br>
> 	
> Password:<br>
> 						            <input
> type="password" size="30" maxlength="60" name="pwd">&nbsp;
> 						            <input
> type="image" src="images/buttons/submit_gray.gif
> <view-source:http://www.gomeznetworks.com/images/buttons/submit_gray.gif
>> " name="login" align="absmiddle">
>
> 						            <input
> type="hidden" name="server_string" value="">
> 						            <input
> type="hidden" name="url_string" value="">
> 						            <input
> type="hidden" name="query_string" value="">
> 						            <input
> type="hidden" name="form_string" value="">
> 					            </td>
>
> and I need to respond to username, password and login. I do not
> understand how to create the NameValuePair to respond to the
> image in order to submit the login and move to the next page in the
> sequence.
>
> Any thoughts, hints ?
>
> Thanks,
>
> Jim
>
> //////////////////////////////////////////
>
>
>
> Jim Langston
> Technical Consultant
> james.langston@compuware.com
>
> The contents of this e-mail are intended for the named addressee  
> only. It contains information that may be confidential. Unless you  
> are the named addressee or an authorized designee, you may not copy  
> or use it, or disclose it to anyone else. If you received it in  
> error please notify us immediately and then destroy it.
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message