Ruby Tip1: Scrap/Read Protected Page Using Mechanize

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 comment