fetch($url); $data = $scrape->removeNewlines($scrape->result); $data = $scrape->fetchBetween('',$data,true); $rows = $scrape->fetchAllBetween('',$data,true); foreach ($rows as $id => $row){ $record = array(); $cells = $scrape->fetchAllBetween('',$row,true); $record['company'] = strip_tags($cells[1]); $url = 'http://www.newyork411.com' . $scrape->fetchBetween('',$cells[1],false); $url = str_replace(' ','%20',$url); $scrape->fetch($url); $data2 = $scrape->removeNewlines($scrape->result); $data2 = $scrape->fetchBetween('
','
',$data2,true); $data2 = $scrape->fetchAfter('
',$data2,false); $details = explode('
',$data2); $record['address'] = $details[0]; $location = explode(',',$details[1]); $record['city'] = trim($location[0]); $location = explode(' ',trim($location[1])); $record['state'] = trim($location[0]); $record['zip'] = trim($location[1]); for($i=2; $i<=5; $i++){ $detail = trim($details[$i]); if(substr($detail,0,6)=='Phone:') $record['phone'] = str_replace('Phone: ','',$detail); else if(substr($detail,0,4)=='Fax:') $record['fax'] = str_replace('Fax: ','',$detail); else if(substr($detail,0,4)=='Web:') $record['web'] = strip_tags(str_replace('Web: ','',$detail)); else if(substr($detail,0,6)=='Email:') $record['email'] = strip_tags(str_replace('Email: ','',$detail)); } print_r($record); die(); } ?>