Re: scripting an interactive web page
Steffen Schulz <[email protected]> Thu, 4 Mar 2010 14:59:06 +1100
| Newsgroups | gmane.org.user-groups.slug.chat |
|---|---|
| Message-ID | <[email protected]> |
On 100304 at 09:45, Ken Foskey wrote: > On Tue, 2010-03-02 at 22:48 +1100, Voytek Eymont wrote: > > I have access to a user/pswd authenticated web site, where, information > > may or may not be present > > > > so, I need to log on, and see if any information is present. > > > > what can I use to auto check periodically, so, it can notify me if any > > information is present? > > As suggested, curl will get the file for you and you have to interpret > the file once retrieved. > > I have found the easiest solution to parsing HTML files is HTML::Parser > in perl. You hook up a method to the reader and check where you are in > the file then extract the data you want. Or if you like to work with shell script, 'xml2' will translate xml into a line-oriented format for easy parsing with grep/sed etc. Alternative to curl is to use good old wget, which might look like: wget --post-data 'username=me&password=foo' --save-cookies session.tmp www.mysite.com/login.php wget -O newpage --load-cookies session.tmp www.mysite/request.php cmp newpage oldpage || echo mysite changed|mail -s "page changed" [email protected] mv newpage oldpage Easy peasy /steffen -- SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html