fetch('http://nces.ed.gov/surveys/libraries/librarysearch/library_list.asp?Search=1&details=0&LibraryName=&LibraryID=&Address=&City=&State=&Zip=' . $zip . '&Miles=5&County=&PhoneAreaCode=&Phone=&LibraryType=CE&LibraryType=BR'); $snoopy->fetch('http://harvester.census.gov/imls/search/library_list.asp?LibraryName=&LibraryID=&Address=&City=&State=&Zip=' . $zip . '&Distance=50&County=&PhoneAreaCode=&Phone=&Librarytype=CE&Librarytype=BR&ResultSetNumber=1&LibTypes=CE%2CBR&StateSelectedIndex=0'); $rawhtml = $snoopy->results; $pattern = "/Library_Detail.*(.*)<\/span><\/a>(.*)<\/span>.*(.*)<\/span>/isU"; preg_match_all($pattern, $rawhtml, $library); $response = trim($library[1][0]) . "\n" . trim(str_replace(" ", " ", $library[2][0])) . "\n" . trim($library[3][0]); echo $response; exit(); ?>