lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lynx-dev] lynx -post_data


From: Thomas Dickey
Subject: Re: [Lynx-dev] lynx -post_data
Date: Sun, 10 Oct 2004 14:41:30 -0400
User-agent: Mutt/1.5.6+20040722i

On Thu, Sep 16, 2004 at 11:53:14AM -0400, address@hidden wrote:
> [ anyone have advice to offer ? ]
> 
> From: Vigneau Philippe <address@hidden>
> To: address@hidden
> 
> I've visited a bunch of websites but no doc on the command
> lynx -post_data... shame !
> so my question is how do you make lynx -post_data
> on the site www.google.com <http://www.google.com/>  (for example)
> I've tried :
>  echo "q=bordeaux" |lynx -nolist -post_data -source http://www.google.fr 
> <http://www.google.fr/>      

If I run lynx -trace, showing what lynx does with the form (interactively of
course), it does a GET rather than a POST.  But scripting this isn't as simple
as changing -post_data to -get_data since the GET is a little complicated:

GET /search?hl=fr&ie=ISO-8859-1&q=bordeaux&btnG=Recherche+Google&meta= 
HTTP/1.0\r
Host: www.google.fr\r
Accept: text/html, text/plain, text/sgml, */*;q=0.01\r
Accept-Encoding: gzip, compress, bzip2\r
Accept-Language: en\r
User-Agent: Lynx/2.8.6dev.4 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.7d\r
Referer: http://www.google.fr/\r

For comparison given script generates this trace:

POST / HTTP/1.0\r
Host: www.google.fr\r
Accept: text/html, text/plain, text/sgml, */*;q=0.01\r
Accept-Language: en\r
User-Agent: Lynx/2.8.6dev.4 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.7d\r
Content-type: application/x-www-form-urlencoded\r
Content-length: 10\r
\r
q=bordeaux

Noting that the page has several buttons before the search field,
I seem to recall some HTML-specific feature that would allow lynx
to detect where it should start in the page (lynx doesn't implement
it, but it might be useful sometime).  However, google's form doesn't
implement that anyway - it uses a JavaScript(*) feature to set the focus
on the text field in the form.  So lynx has no clues to decide if the
text field is interesting enough that we could make a special case
to make POST "work" for this.

However, the form uses GET, which is the default for forms.  The only
improvement I could see here would be to modify lynx to recognize the
script that tells where the initial focus lies (or that there's only
one form on the page - a special case) and apply the -get_data option's
value to that.

(*) a check with elinks demonstrates that it does not recognize
    the given JavaScript feature.

-- 
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]