$sql = 'update tb_municipality set feed_dated=now() where id=' . $cid; $res = mysql_query($sql); $dsid = $cityrow['default_subdivision']; $fields_needed = array('zz', 'housenum', 'propcode', 'bedrooms_up', 'bedrooms_down', 'fullbaths', 'halfbaths', 'sqftg', 'age', 'publicoverview', 'lprice', 'taxes', 'taxyr', 'la1_a_userid', 'la2_a_userid', 'mlsnumber', 'lotsize_acres', 'garage', 'daysonmarket', 'matrix_unique_id', 'photocount', 'sdistrict', 'city', 'street', 'strtyp', 'status', 'major_area', 'dl1_range', 'dl1_section', 'dl1_township', 'dl1_westofmeridian', 'dl1_location'); $data_field = array('zz', 'building_no', 'postalcode', 'beds_up', 'beds_down', 'full_baths', 'half_baths', 'square_footage', 'building_age', 'public_overview', 'listing_price', 'tax_amount', 'tax_year', 'realtor1id', 'realtor2id', 'listing_no', 'acres', 'garage_typeid', 'days_on_market', '', '', '', '', '', '', '', '', '', '', '', '', ''); $found = array(); $rets = new RETS(); //Login to NAR CRT Test Server $results = $rets->login($Host = 'http://matrix.gpreb.com/rets/login.ashx', $Account = 'Division1', $Password = '******', $User_Agent = 'RETS_class/1.0', $User_Agent_Pwd = null, $User_Agent_Auth = false, $Rets_Version = 'RETS/1.5', $Standard_Names = false, $Post_Requests = true, $Format = 'COMPACT-DECODED', $HTTP_Logging = true); if (!$results) { exit; } $clss = array('RESI', 'FARM', 'MULTI', 'COMM'); for ($mm = 0; $mm <= 3; $mm++) { echo $clss[$mm] . '<br>'; $response = $rets->Search($Resource = 'Property', $Class = $clss[$mm], $Count = 1, $Format, $Limit = 2500, $QueryType = 'DMQL2', $Standard_Names, $Select = '*', $Query = '((City=*))'); usleep(50000); $doc = new DOMDocument(); $doc->loadXML($response); echo $doc->getElementsByTagName("COLUMNS")->item(0)->nodeValue; $col = strtolower($doc->getElementsByTagName("COLUMNS")->item(0)->nodeValue); $columns = explode("\t", $col); echo $response; $mlsno = -1; $statusno = -1; $majorarea = -1; $real1 = -1; $real2 = -1; for ($i = 0; $i < count($fields_needed); $i++) { $match = array_search($fields_needed[$i], $columns); echo $i . '-' . $fields_needed[$i] . '-' . $match . "\n";
$cityrow = mysql_fetch_array($res, MYSQL_ASSOC); $cid = $cityrow['id']; $dsid = $cityrow['default_subdivision']; $sql = 'update tb_municipality set feed_dated="' . date('Y-m-d') . ' where id=' . $cid; $res = mysql_query($sql); $fields_needed = array('zz', 'housenum', 'propcode', 'bedrooms_up', 'bedrooms_down', 'fullbaths', 'halfbaths', 'sqftg', 'age', 'publicoverview', 'lprice', 'taxes', 'taxyr', 'la1_a_userid', 'la2_a_userid', 'mlsnumber', 'matrix_unique_id', 'photocount', 'sdistrict', 'city', 'street', 'strtyp'); $data_field = array('zz', 'building_no', 'postalcode', 'beds_up', 'beds_down', 'full_baths', 'half_baths', 'square_footage', 'building_age', 'public_overview', 'listing_price', 'tax_amount', 'tax_year', 'realtor1id', 'realtor2id', 'listing_no', '', '', '', '', '', ''); $found = array(); $rets = new RETS(); //Login to NAR CRT Test Server $results = $rets->login($Host = 'http://matrix.gpreb.com/rets/login.ashx', $Account = 'Division1', $Password = '******', $User_Agent = 'RETS_class/1.0', $User_Agent_Pwd = null, $User_Agent_Auth = false, $Rets_Version = 'RETS/1.5', $Standard_Names = false, $Post_Requests = true, $Format = 'COMPACT-DECODED', $HTTP_Logging = true, $Log_File = 'C:/http.log'); if (!$results) { exit; } if ($_GET['type'] == 'listing') { $response = $rets->Search($Resource = 'Property', $Class = 'RESI', $Count = 1, $Format, $Limit = 150, $QueryType = 'DMQL2', $Standard_Names, $Select = '*', $Query = '((City=Grande Prairie))'); //echo $response; $doc = new DOMDocument(); $doc->loadXML($response); $col = strtolower($doc->getElementsByTagName("COLUMNS")->item(0)->nodeValue); $columns = explode("\t", $col); for ($i = 0; $i < count($fields_needed); $i++) { $match = array_search($fields_needed[$i], $columns); if ($match > 0) { $found[$i] = $match; } else { $found[$i] = -1; } } for ($i = 1; $i < count($found); $i++) { if ($found[$i] == -1) {