Exemple #1
0
$res = mysql_query($sql);
if (date('D') == 'Sat' or date('D') == 'Sun') {
    // dont run Saturday or Sunday
    die;
}
$sql = 'select * from tb_municipality where name="' . $city . '"';
$res = mysql_query($sql);
$cityrow = mysql_fetch_array($res, MYSQL_ASSOC);
$cid = $cityrow['id'];
$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);
Exemple #2
0
 * Created by PhpStorm.
 * User: mbitson
 * Date: 9/29/2014
 * Time: 11:38 AM
 * This scrip assumes a property post type with
 * custom fields already configured.
 * You can configure the fields
 * that are mapped to in: RETS::formatForNexes
 * Please note that your RETS server may use different fields labels.
 */
// Include RETS config
require_once 'rets-config.php';
require_once 'rets.php';
require_once 'wp-manager.php';
// Init a rets class
$rets = new RETS();
// Init a wordpress manager class
$wp = new WPManager();
// Set params required to run on our server
$rets->__set('host', RETS_HOST);
// Specify full path to cookie file.
$rets->__set('username', RETS_USERNAME);
// Specify full path to cookie file.
$rets->__set('password', RETS_PASSWORD);
// Specify full path to cookie file.
$rets->__set('Login', RETS_LOGIN);
// Specify full path to cookie file.
$rets->__set('cookie_file', COOKIE_FILE);
// Specify full path to cookie file.
$rets->__set('disable_follow_location', DISABLE_FOLLOW_LOCATION);
// Disable follow location as open_basedir restirction is in effect.
Exemple #3
0
<?php

require_once 'dbconnect/dbconnect.php';
require_once 'utilities/utilities.php';
require_once 'RETS.php';
if (mysql_select_db("home365_ios", $useradmin)) {
} else {
    echo "Error selecting database, exited.";
    exit;
}
$rets = new RETS();
$rets->url = 'http://brc.retsca.interealty.com/Login.asmx/Login';
$rets->user = '******';
$rets->password = '******';
$rets->useragent = 'RETSAllisonJiang/1.0';
$rets->useragent_password = '******';
$current_GMT_time = get_GMT(time());
$current_GMT_time_string = date("Y-m-d H:i:s", $current_GMT_time);
$current_YVR_time = getTimeByCity($current_GMT_time, 'YVR');
$current_YVR_time_string = date("Y-m-d H:i:s", $current_YVR_time);
//The following code is to test if the cron job is executed.
$file = "file.txt";
$current = file_get_contents($file);
$current .= "{$current_YVR_time_string}\n";
file_put_contents($file, $current);
//login and receive server response.
$response = $rets->Login();
var_dump($response);
//$response=$rets->GetCount('Property','11','(363=|A)');
//print $response.'<br/>';
$sysid_array = $rets->GetDataArray('Property', '11', '(363=|A)', 'sysid', null);
Exemple #4
0
<?php

require_once 'dbconnect/dbconnect.php';
require_once 'utilities/utilities.php';
require_once 'RETS.php';
if (mysql_select_db("home365_ios", $useradmin)) {
} else {
    echo "Error selecting database, exited.";
    exit;
}
$rets = new RETS();
$rets->url = 'http://brc.rebretstest.interealty.com/Login.asmx/Login';
$rets->user = '******';
$rets->password = '******';
$rets->useragent = 'RETSAllisonJiang/1.0';
$rets->useragent_password = '******';
$response = $rets->Login();
var_dump($response);
$listings_array = $rets->GetDataArray('Property', '11', '(363=|A)', null, null);
foreach ($listings_array as $key => $value) {
    $selectSQL = "SELECT * FROM listings WHERE sysid=" . $value['sysid'];
    $get_listing = mysql_query_or_die($selectSQL, $useradmin);
    if ($row_get_listing = mysql_fetch_assoc($get_listing)) {
        echo "Record found in database\n";
        $updateSQL = sprintf("UPDATE listings SET property_type=%s, address=%s, postal_code=%s, unit_number=%s, city=%s, province=%s, built_year=%s, house_number=%s, list_price=%s, list_date=%s, mls_number=%s, bedrooms=%s, bathrooms=%s, public_remarks=%s, public_remarks_2=%s, lot_size_sqt=%s, lot_size_sqm=%s, floor_area_total=%s, site_influences=%s, type_of_dwelling=%s,publish_on_internet=%s, status=%s WHERE sysid=" . $value['sysid'], GetSQLValueString($value['1'], "text"), GetSQLValueString($value['14'], "text"), GetSQLValueString($value['11'], "text"), GetSQLValueString($value['2971'], "int"), GetSQLValueString($value['3794'], "text"), GetSQLValueString($value['88'], "text"), GetSQLValueString($value['16'], "int"), GetSQLValueString($value['181'], "int"), GetSQLValueString($value['226'], "double"), GetSQLValueString($value['224'], "date"), GetSQLValueString($value['248'], "text"), GetSQLValueString($value['378'], "int"), GetSQLValueString($value['3928'], "int"), GetSQLValueString($value['411'], "text"), GetSQLValueString($value['3985'], "text"), GetSQLValueString($value['2457'], "double"), GetSQLValueString($value['2460'], "double"), GetSQLValueString($value['3922'], "double"), GetSQLValueString($value['3926'], "text"), GetSQLValueString($value['2733'], "text"), GetSQLValueString($value['3'] == 'Yes' ? 'Y' : 'N', "text"), GetSQLValueString($value['363'] == 'Active' ? 'A' : 'D', "text"), GetSQLValueString($value['sysid'], "int"));
        $result = mysql_query_or_die($updateSQL, $useradmin);
        $album_id = get_album_id($value['sysid']);
        if (!$album_id) {
            $album_id = create_album($value['sysid']);
        }
    } else {
Exemple #5
0
<?php

require_once 'dbconnect/dbconnect.php';
require_once 'utilities/utilities.php';
require_once 'RETS.php';
if (mysql_select_db("home365_ios", $useradmin)) {
} else {
    echo "Error selecting database, exited.";
    exit;
}
$current_GMT_time = get_GMT(time());
$current_GMT_time_string = date("Y-m-d H:i:s", $current_GMT_time);
$current_YVR_time = getTimeByCity($current_GMT_time, 'YVR');
$current_YVR_time_string = date("Y-m-d H:i:s", $current_YVR_time);
$rets = new RETS();
$rets->url = 'http://brc.retsca.interealty.com/Login.asmx/Login';
$rets->user = '******';
$rets->password = '******';
$rets->useragent = 'RETSAllisonJiang/1.0';
$rets->useragent_password = '******';
//The following code is to test if the cron job is executed.
$file = "file.txt";
$current = file_get_contents($file);
$current .= "{$current_YVR_time_string} from import_sysid.php\n";
file_put_contents($file, $current);
$selectSQL = "SELECT COUNT(*) AS table_size FROM sysid_raw_new";
$get_table_size = mysql_query_or_die($selectSQL, $useradmin);
$number_of_new_sysid = 0;
if ($row_get_table_size = mysql_fetch_assoc($get_table_size)) {
    $number_of_new_sysid = $row_get_table_size['table_size'];
}
Exemple #6
0
<?php

require_once 'dbconnect/dbconnect.php';
require_once 'utilities/utilities.php';
require_once 'RETS.php';
header('Content-Type: text/html; charset=utf-8');
if (mysql_select_db("home365_ios", $useradmin)) {
} else {
    echo "Error selecting database, exited.";
    exit;
}
$rets = new RETS();
$rets->url = 'http://brc.retsca.interealty.com/Login.asmx/Login';
$rets->user = '******';
$rets->password = '******';
$rets->useragent = 'RETSAllisonJiang/1.0';
$rets->useragent_password = '******';
$current_GMT_time = get_GMT(time());
$current_GMT_time_string = date("Y-m-d H:i:s", $current_GMT_time);
$current_YVR_time = getTimeByCity($current_GMT_time, 'YVR');
$current_YVR_time_string = date("Y-m-d H:i:s", $current_YVR_time);
$before1hr_time_string = date("Y-m-d H:i:s", $current_YVR_time - 3600);
$file = "album.txt";
$current = file_get_contents($file);
$current .= "{$current_YVR_time_string}\n";
file_put_contents($file, $current);
$deleteSQL = "DELETE FROM sysid_raw_recent_image_update WHERE sysid IN (SELECT sysid FROM listings WHERE date_updated_local>='" . $before1hr_time_string . "')";
$result = mysql_query_or_die($deleteSQL, $useradmin);
$selectSQL = "SELECT SQL_CALC_FOUND_ROWS DISTINCT sysid_raw_recent_image_update.sysid, sysid_raw_recent_image_update.num_of_photos FROM sysid_raw_recent_image_update" . " LEFT JOIN listings ON sysid_raw_recent_image_update.sysid=listings.sysid" . " WHERE !ISNULL(listings.sysid)" . " ORDER BY RAND() LIMIT 0, 5";
$get_sysid = mysql_query_or_die($selectSQL, $useradmin);
$row = mysql_fetch_row(mysql_query("SELECT FOUND_ROWS()", $useradmin));
Exemple #7
0
<?php

require_once 'dbconnect/dbconnect.php';
require_once 'utilities/utilities.php';
require_once 'RETS.php';
if (mysql_select_db("home365_ios", $useradmin)) {
} else {
    echo "Error selecting database, exited.";
    exit;
}
$rets = new RETS();
$rets->url = 'http://brc.retsca.interealty.com/Login.asmx/Login';
$rets->user = '******';
$rets->password = '******';
$rets->useragent = 'RETSAllisonJiang/1.0';
$rets->useragent_password = '******';
$current_GMT_time = get_GMT(time());
$current_GMT_time_string = date("Y-m-d H:i:s", $current_GMT_time);
$current_YVR_time = getTimeByCity($current_GMT_time, 'YVR');
$current_YVR_time_string = date("Y-m-d H:i:s", $current_YVR_time);
$before1hr_time_string = date("Y-m-d H:i:s", $current_YVR_time - 3600);
$selectSQL = "SELECT SQL_CALC_FOUND_ROWS DISTINCT sysid FROM listings WHERE (ISNULL(listings.album_id) OR num_of_photos<=1) AND status='A' AND property_type!='Land Only' ORDER BY RAND() LIMIT 0, 10";
$get_sysid = mysql_query_or_die($selectSQL, $useradmin);
$row = mysql_fetch_row(mysql_query("SELECT FOUND_ROWS()", $useradmin));
//login and receive server response.
if (is_array($row) && $row[0] > 0) {
    echo '<br/>' . $row[0] . 'records needs to be album_patched.<br/>';
    $response = $rets->Login();
    while ($row_get_sysid = mysql_fetch_assoc($get_sysid)) {
        echo '<br/><br/>checking:<span style="color:#00ff00;">' . $row_get_sysid['sysid'] . '</span><br/>';
        $album_id = check_and_insert($row_get_sysid['sysid']);
Exemple #8
0
 <?php 
require_once 'RETS.php';
# set up RETS
# note: all values within <> need to be replaced
# note: all the resource, class, lookup, and field identifiers in the examples
#       are from the BRC system
$rets = new RETS();
$rets->url = 'http://brc.retsca.interealty.com/Login.asmx/Login';
$rets->user = '******';
$rets->password = '******';
$rets->useragent = 'RETSAllisonJiang/1.0';
$rets->useragent_password = '******';
# login example
print "===========Login===========\n";
$response = $rets->Login();
print "===========Login Finish===========\n";
# login example using SafeMLS
# $rets->safemls_pin="<SafeMLS Device PIN>";
# $rets->password="******";
# $response=$rets->Login();
# get metadata examples
#
###       # resource metadata where ID=0 (all resources)
#print"===========get metadata:resource===========\n";
#$response=$rets->GetMetadata('METADATA-RESOURCE','0');
#print $response;
#print"===========get metadata:resource finish===========\n";
#print "\n\n";
#
###       # class metadata where ID=0 (all resources and classes)
#print"===========get metadata:class===========\n";
Exemple #9
0
<?php

error_reporting(E_ALL);
$document_root = '/home/home365/public_html';
$domain_name = 'http://www.home365.ca/';
require_once $document_root . '/dbconnect/dbconnect.php';
require_once $document_root . '/utilities/utilities.php';
require_once $document_root . '/RETS.php';
if (mysql_select_db("home365_ios", $useradmin)) {
} else {
    echo "Error selecting database, exited.";
    exit;
}
$rets = new RETS();
$rets->url = 'http://brc.retsca.interealty.com/Login.asmx/Login';
$rets->user = '******';
$rets->password = '******';
$rets->useragent = 'RETSAllisonJiang/1.0';
$rets->useragent_password = '******';
$current_GMT_time = get_GMT(time());
$current_GMT_time_string = date("Y-m-d H:i:s", $current_GMT_time);
$current_YVR_time = getTimeByCity($current_GMT_time, 'YVR');
$current_YVR_time_string = date("Y-m-d H:i:s", $current_YVR_time);
$current_YVR_date = date("Y-m-d", $current_YVR_time);
$mls = $_POST['mls'];
$response = $rets->Login();
$response = $rets->GetDataArray('Property', '11', '(248=' . $mls . ')', 'sysid,248,363,217', 2);
$temp_sysid = $response[0]['sysid'];
$selectSQL = "SELECT * FROM listings WHERE sysid={$temp_sysid}";
$get_listing = mysql_query_or_die($selectSQL, $useradmin);
if ($listing_detail = mysql_fetch_assoc($get_listing)) {
Exemple #10
0
<?php

require_once 'dbconnect/dbconnect.php';
require_once 'utilities/utilities.php';
require_once 'RETS.php';
if (mysql_select_db("home365_ios", $useradmin)) {
} else {
    echo "Error selecting database, exited.";
    exit;
}
$rets = new RETS();
$rets->url = 'http://brc.retsca.interealty.com/Login.asmx/Login';
$rets->user = '******';
$rets->password = '******';
$rets->useragent = 'RETSAllisonJiang/1.0';
$rets->useragent_password = '******';
$current_GMT_time = get_GMT(time());
$current_GMT_time_string = date("Y-m-d H:i:s", $current_GMT_time);
$current_YVR_time = getTimeByCity($current_GMT_time, 'YVR');
$current_YVR_time_string = date("Y-m-d H:i:s", $current_YVR_time);
//login and receive server response.
$response = $rets->Login();
var_dump($response);
//The following code is to test if the cron job is executed.
$file = "file.txt";
$current = file_get_contents($file);
$current .= "{$current_YVR_time_string} from sysid_test.php\n";
file_put_contents($file, $current);
$sysid_array = $rets->GetDataArray('Property', '11', '(363=|A)', 'sysid', null);
//var_dump($sysid_array);
$truncateSQL = "TRUNCATE TABLE sysid_raw_current";