コード例 #1
0
ファイル: mls-3-get-properties.php プロジェクト: ezinaz/rets
$property_classes = array("A");
// DateTime which is used to determine how far back to retrieve records.
// using a really old date so we can get everything
//$previous_start_time = "2016-02-12T00:00:00";
//$previous_start_time = "2016-01-01T00:00:00";
$config = new \PHRETS\Configuration();
$rets_config = $ini['rets_config'];
$config->setLoginUrl($rets_config['loginurl']);
$config->setUsername($rets_config['username']);
$config->setPassword($rets_config['password']);
$config->setRetsVersion($rets_config['rets-version']);
$config->setHttpAuthenticationMethod('digest');
$config->setOption('disable_follow_location', false);
$config->setOption('use_post_method', true);
$rets = new \PHRETS\Session($config);
$rets->setLogger($log);
$connect = $rets->Login();
$file = fopen('output/Property-A-fields.csv', 'r');
$header = fgetcsv($file);
$fields = array();
while (($result = fgetcsv($file)) !== false) {
    $fields[] = $result[0];
}
foreach ($property_classes as $class) {
    echo "+ Property:{$class}<br>\n";
    $file_name = strtolower("data/property_{$class}_data.csv");
    $fh = fopen($file_name, "w+");
    fputcsv($fh, $fields);
    $maxrows = true;
    //$offset = 1;
    $limit = 500;