lua-users home
lua-l archive

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


On 30.05.2010 00:13, John Edwards wrote:
> Dear All,
> 
> I would like to be able to use Lua to automate the submission of a web
> form E.G. :
> 
> <form method="post" action="/cgi-bin/formmail.pl">
> <input name="body" value="" type="hidden">
> <input name="recipient" value="recipient@somedomain.com" type="hidden">
> <strong>Name : </strong><input size="40" name="realname" type="text"><br>
> <strong>Subject : </strong><input size="40" name="subject" type="text"><br>
> <input value="Submit" type="submit"></p>
> </form>
> 
> I have seen luasocket but can't find any examples of how to use it to
> submit a form.
> I guess my first question should be is luasocket the correct technique
> and if so, how should I do it ?

luasocket is a socket/http level library. Parsing forms is higher level
problem - it is parsing of HTML (or XML). So you would need at least
another library for parsing HTML.

> Please excuse my lack of knowledge of Lua but I am new to it and hoping
> to find a high level solution such as perl's WWW::Mechanize / LWP.

Sorry to dissapoint you, but there is no mechanize-like library for lua
(at least I am not aware of any, and was looking for one for years). So
you wolud need to write your own port, or use perl/python/ruby version.
It would be great if someone could port mechanize for lua.

> PS if this is a FAQ please feel free to point me in the right direction.

Lua is meant primarily as an embedded language, so there is no such a
great number of libraries like for other languages (mechanize included).

Regards,
miko