The Little Guy Posted June 13, 2007 Share Posted June 13, 2007 OK... I got this from a book (Everything except for the mysql). I am trying to take results and save them into a database. What the code does is it starts at a root site, then reads all the links and follows them. What I want to do is take what the link says, then save it in a database. any help? <?php $dbHost = "localhost"; //Location Of Database usually its localhost $dbUser = "xxx"; //Database User Name $dbPass = "xxx"; //Database Password $dbDatabase = "spider"; //Database Name $db = mysqli_connect("$dbHost", "$dbUser", "$dbPass") or die ("Error connecting to database."); mysqli_select_db($db,"$dbDatabase") or die ("Couldn't select the database."); include 'LIB_http.php'; include 'LIB_parse.php'; include 'LIB_resolve_addresses.php'; include 'LIB_exclusion_list.php'; include 'LIB_simple_spider.php'; set_time_limit(3600); $SEED_URL = 'http://google.com'; $MAX_PENETRATION = 1; $ALLOW_OFFISTE = FALSE; $spider_array = array(); echo "Harvesting Seed URL\n"; $temp_link_array = harvest_links($SEED_URL); $spider_array = archive_links($spider_array, 0, $temp_link_array); for($penetration_level=1;$penetration_level<=$MAX_PENETRATION;$penetration_level++){ $previous_level = $penetration_level - 1; for($xx=0; $xx<count($spider_array[$previous_level]);$xx++){ unset($temp_link_array); $temp_link_array = harvest_links($spider_array[$previous_level][$xx]); echo "Level=$penetration_level, xx=$xx of".count($spider_array[$previous_level])."\n"; $spider_array = archive_links($spider_array, $penetration_level, $temp_link_array); } } ?> Link to comment https://forums.phpfreaks.com/topic/55363-solved-spider/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.