Ruby Tip1: Scrap/Read Protected Page Using Mechanize

14 sec read

If you want to automagically login to a remote page, then scrap/read the remote content, Mechanize would be right choice for you.
The sample code will access the demo site http://www.cmsimple.org, login with the password “test”, then reads its protected menus using Nokogiri.


Running through the sample will print
[source language=”html”]
NORMAL MODE
VALIDATE LINKS
IMAGES
DOWNLOADS
SETTINGS
HELP
LOGOUT
[/source]

Related posts:

Leave a Reply

Your email address will not be published. Required fields are marked *