You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Stefan at WPF <st...@googlemail.com> on 2012/01/30 21:56:13 UTC

Get value of a form field?

Hello,

using Apache HTTPClient, is it possible to get the value of a form field of
a website? I guess that's already considered parsing and therefore not part
of the httpclient? I am just a little bit irritated as it's possible to set
form values when using http post. Thanks for you help :-)

Best regards
Stefan

Re: Get value of a form field?

Posted by Ken Krugler <kk...@transpac.com>.
Hi Stefan,

What you're asking for is something out of scope for HttpClient.

I'd suggest looking at Nutch or other Java web crawlers, as they typically have some level of support for form-based authentication.

-- Ken

On Jan 30, 2012, at 1:49pm, Stefan at WPF wrote:

> Thank you Ken, I have read the mentioned link, but that doesn't help me ):
> I need to login to a website, which normally isn't a problem, but on the
> login page there's a hidden field with a specific value that needs to be
> send during the login (in addition to username and password). To send the
> value of this hidden field during the login process, I need to get it's
> value first - is that possible using httpclient? Normally I would say no as
> it is no header field and something that needs to be parsed (not a task of
> httpclient), but as httpclient can send forms, I am wondering if it maybe
> is possible and I yet just didn't see how to do that?
> 
> 2012/1/30 Ken Krugler <kk...@transpac.com>
> 
>> Assuming you've already read
>> http://hc.apache.org/httpcomponents-client-ga/primer.html, could you
>> provide more details of what exactly you're trying to do with HttpClient?
>> 
>> -- Ken
>> 
>> On Jan 30, 2012, at 12:56pm, Stefan at WPF wrote:
>> 
>>> Hello,
>>> 
>>> using Apache HTTPClient, is it possible to get the value of a form field
>> of
>>> a website? I guess that's already considered parsing and therefore not
>> part
>>> of the httpclient? I am just a little bit irritated as it's possible to
>> set
>>> form values when using http post. Thanks for you help :-)
>>> 
>>> Best regards
>>> Stefan
>> 
>> --------------------------
>> Ken Krugler
>> http://www.scaleunlimited.com
>> custom big data solutions & training
>> Hadoop, Cascading, Mahout & Solr
>> 
>> 
>> 
>> 
>> 

--------------------------
Ken Krugler
http://www.scaleunlimited.com
custom big data solutions & training
Hadoop, Cascading, Mahout & Solr





Re: Get value of a form field?

Posted by kim young ill <kh...@googlemail.com>.
depends on how the page is build, if there're pretty much js used for
building the dom, httpclient will not help, it's not browser, i think
htmlUnit use internally rhino (js-engine) which can help.



On Mon, Jan 30, 2012 at 11:04 PM, Daniel Holm <da...@gmail.com> wrote:

> I use jsoup (http://jsoup.org/) to parse and extract values. Check out the
> info about selector syntax in the jsoup cookbook, it's quite easy to use.
>
> Daniel
>
> On Mon, Jan 30, 2012 at 22:49, Stefan at WPF
> <st...@googlemail.com>wrote:
>
> > Thank you Ken, I have read the mentioned link, but that doesn't help me
> ):
> > I need to login to a website, which normally isn't a problem, but on the
> > login page there's a hidden field with a specific value that needs to be
> > send during the login (in addition to username and password). To send the
> > value of this hidden field during the login process, I need to get it's
> > value first - is that possible using httpclient? Normally I would say no
> as
> > it is no header field and something that needs to be parsed (not a task
> of
> > httpclient), but as httpclient can send forms, I am wondering if it maybe
> > is possible and I yet just didn't see how to do that?
> >
> > 2012/1/30 Ken Krugler <kk...@transpac.com>
> >
> > > Assuming you've already read
> > > http://hc.apache.org/httpcomponents-client-ga/primer.html, could you
> > > provide more details of what exactly you're trying to do with
> HttpClient?
> > >
> > > -- Ken
> > >
> > > On Jan 30, 2012, at 12:56pm, Stefan at WPF wrote:
> > >
> > > > Hello,
> > > >
> > > > using Apache HTTPClient, is it possible to get the value of a form
> > field
> > > of
> > > > a website? I guess that's already considered parsing and therefore
> not
> > > part
> > > > of the httpclient? I am just a little bit irritated as it's possible
> to
> > > set
> > > > form values when using http post. Thanks for you help :-)
> > > >
> > > > Best regards
> > > > Stefan
> > >
> > > --------------------------
> > > Ken Krugler
> > > http://www.scaleunlimited.com
> > > custom big data solutions & training
> > > Hadoop, Cascading, Mahout & Solr
> > >
> > >
> > >
> > >
> > >
> >
>

Re: Get value of a form field?

Posted by Daniel Holm <da...@gmail.com>.
I use jsoup (http://jsoup.org/) to parse and extract values. Check out the
info about selector syntax in the jsoup cookbook, it's quite easy to use.

Daniel

On Mon, Jan 30, 2012 at 22:49, Stefan at WPF
<st...@googlemail.com>wrote:

> Thank you Ken, I have read the mentioned link, but that doesn't help me ):
> I need to login to a website, which normally isn't a problem, but on the
> login page there's a hidden field with a specific value that needs to be
> send during the login (in addition to username and password). To send the
> value of this hidden field during the login process, I need to get it's
> value first - is that possible using httpclient? Normally I would say no as
> it is no header field and something that needs to be parsed (not a task of
> httpclient), but as httpclient can send forms, I am wondering if it maybe
> is possible and I yet just didn't see how to do that?
>
> 2012/1/30 Ken Krugler <kk...@transpac.com>
>
> > Assuming you've already read
> > http://hc.apache.org/httpcomponents-client-ga/primer.html, could you
> > provide more details of what exactly you're trying to do with HttpClient?
> >
> > -- Ken
> >
> > On Jan 30, 2012, at 12:56pm, Stefan at WPF wrote:
> >
> > > Hello,
> > >
> > > using Apache HTTPClient, is it possible to get the value of a form
> field
> > of
> > > a website? I guess that's already considered parsing and therefore not
> > part
> > > of the httpclient? I am just a little bit irritated as it's possible to
> > set
> > > form values when using http post. Thanks for you help :-)
> > >
> > > Best regards
> > > Stefan
> >
> > --------------------------
> > Ken Krugler
> > http://www.scaleunlimited.com
> > custom big data solutions & training
> > Hadoop, Cascading, Mahout & Solr
> >
> >
> >
> >
> >
>

Re: Get value of a form field?

Posted by Stefan at WPF <st...@googlemail.com>.
Thank you Ken, I have read the mentioned link, but that doesn't help me ):
I need to login to a website, which normally isn't a problem, but on the
login page there's a hidden field with a specific value that needs to be
send during the login (in addition to username and password). To send the
value of this hidden field during the login process, I need to get it's
value first - is that possible using httpclient? Normally I would say no as
it is no header field and something that needs to be parsed (not a task of
httpclient), but as httpclient can send forms, I am wondering if it maybe
is possible and I yet just didn't see how to do that?

2012/1/30 Ken Krugler <kk...@transpac.com>

> Assuming you've already read
> http://hc.apache.org/httpcomponents-client-ga/primer.html, could you
> provide more details of what exactly you're trying to do with HttpClient?
>
> -- Ken
>
> On Jan 30, 2012, at 12:56pm, Stefan at WPF wrote:
>
> > Hello,
> >
> > using Apache HTTPClient, is it possible to get the value of a form field
> of
> > a website? I guess that's already considered parsing and therefore not
> part
> > of the httpclient? I am just a little bit irritated as it's possible to
> set
> > form values when using http post. Thanks for you help :-)
> >
> > Best regards
> > Stefan
>
> --------------------------
> Ken Krugler
> http://www.scaleunlimited.com
> custom big data solutions & training
> Hadoop, Cascading, Mahout & Solr
>
>
>
>
>

Re: Get value of a form field?

Posted by Ken Krugler <kk...@transpac.com>.
Assuming you've already read http://hc.apache.org/httpcomponents-client-ga/primer.html, could you provide more details of what exactly you're trying to do with HttpClient?

-- Ken

On Jan 30, 2012, at 12:56pm, Stefan at WPF wrote:

> Hello,
> 
> using Apache HTTPClient, is it possible to get the value of a form field of
> a website? I guess that's already considered parsing and therefore not part
> of the httpclient? I am just a little bit irritated as it's possible to set
> form values when using http post. Thanks for you help :-)
> 
> Best regards
> Stefan

--------------------------
Ken Krugler
http://www.scaleunlimited.com
custom big data solutions & training
Hadoop, Cascading, Mahout & Solr