You are looking for a web scraper which is an application designed for reading the data on a web page and processing it. The scraper is part of a crawler (the crawler also traverses the links on a page to find other pages out on the net).
Web scrapers and crawlers should honor the robot exclusion standard specified in robots.txt. For facebook, this is at http://www.facebook.com/robots.txt
Note the specific list of allowed user agents (googlebot for example). And the last one:
Which says "you shouldn't be doing anything if you are not allowed".
There is a page mentioned in the human readable part of robots.txt:
# Notice: if you would like to crawl Facebook you can
# contact us here: http://www.facebook.com/apps/site_scraping_tos.php
# to apply for white listing. Our general terms are available
# at http://www.facebook.com/apps/site_scraping_tos_terms.php
http://www.facebook.com/apps/site_scraping_tos_terms.php starts out with:
- These terms govern your collection of data from Facebook through automated means, such as through harvesting bots, robots, spiders, or scrapers ("Automated Data Collection"), as well as your use of that data.
- You will not engage in Automated Data Collection without Facebook's express written permission.
I would suggest reading How I got sued by Facebook - their lawyers do have teeth.