Example #1
0
<?php

include_once 'librets.php';
$session = new RetsSession("http://demo.crt.realtors.org:6103/rets/login");
$session->SetHttpLogName("logfile");
if (!$session->Login("Joe", "Schmoe")) {
    print "Invalid Login\n";
    exit(1);
}
$loginResponse = $session->GetLoginResponse();
$capurls = $session->GetCapabilityUrls();
print "Member name: " . $loginResponse->GetMemberName() . "\n";
print "Search URL: " . $capurls->GetSearchUrl() . "\n";
print "Action: " . $session->GetAction() . "\n";
$version = "1.0";
if ($session->GetDetectedRetsVersion() == RETS_1_5) {
    $version = "1.5";
}
print "RETS Version: " . $version . "\n";
$logout = $session->Logout();
print "Billing info: " . $logout->GetBillingInfo() . "\n";
print "Logout message: " . $logout->GetLogoutMessage() . "\n";
print "Connect time: " . $logout->GetConnectTime() . "\n";
Example #2
0
        case MetadataTable::TINY:
            return "Tiny";
        case MetadataTable::SMALL:
            return "Small";
        case MetadataTable::INT:
            return "Int";
        case MetadataTable::LONG:
            return "Long";
        case MetadataTable::DECIMAL:
            return "Decimal";
        default:
            return "Unknown";
    }
}
try {
    $session = new RetsSession("http://demo.crt.realtors.org:6103/rets/login");
    if (!$session->Login("Joe", "Schmoe")) {
        print "Invalid Login\n";
        exit(1);
    }
    $session->SetIncrementalMetadata(false);
    $session->SetRetsVersion(RETS_1_5);
    $filename = "rawmetadata.xml";
    $fd = fopen($filename, "w");
    // Do the GetMetadata and get all the raw XML.
    $results = $session->GetMetadataAsString();
    fwrite($fd, $results);
    fclose($fd);
    $logout = $session->Logout();
    // Reread the file and inject the content into the metadata for parsing.
    $fd = fopen($filename, "r");
Example #3
0
<?php

include_once 'librets.php';
$session = new RetsSession("http://www.dis.com:6103/rets/login");
if (!$session->Login("Joe", "Schmoe")) {
    print "Invalid Login\n";
    exit(1);
}
print "Action: " . $session->GetAction() . "\n";
$version = "1.0";
if ($session->GetDetectedRetsVersion() == RETS_1_5) {
    $version = "1.5";
}
print "RETS Version: " . $version . "\n";
$request = $session->CreateSearchRequest("Property", "RES", "(ListPrice=300000-)");
$request->SetSelect("ListingID,ListPrice,Beds,City");
$request->SetLimit(SearchRequest_LIMIT_DEFAULT);
$request->SetOffset(SearchRequest_OFFSET_NONE);
$request->SetCountType(SearchRequest_RECORD_COUNT_AND_RESULTS);
$request->SetFormatType(SearchRequest_COMPACT);
$request->SetStandardNames(true);
$results = $session->Search($request);
print "Record Count: " . $results->GetCount() . "\n\n";
$columns = $results->GetColumns();
while ($results->HasNext()) {
    for ($i = 0; $i < $columns->size(); $i++) {
        print $columns->get($i) . ": " . $results->GetString($i) . "\n";
    }
    print "\n";
}
$logout = $session->Logout();
Example #4
0
        case MetadataTable::TIME:
            return "Time";
        case MetadataTable::TINY:
            return "Tiny";
        case MetadataTable::SMALL:
            return "Small";
        case MetadataTable::INT:
            return "Int";
        case MetadataTable::LONG:
            return "Long";
        case MetadataTable::DECIMAL:
            return "Decimal";
        default:
            return "Unknown";
    }
}
$session = new RetsSession("http://demo.crt.realtors.org:6103/rets/login");
if (!$session->Login("Joe", "Schmoe")) {
    print "Invalid Login\n";
    exit(1);
}
$session->SetIncrementalMetadata(false);
$session->SetRetsVersion(RETS_1_5);
$metadata = $session->GetMetaData();
dump_system($metadata);
dump_foreign_keys($metadata);
dump_all_resources($metadata);
$logout = $session->Logout();
print "Billing info: " . $logout->GetBillingInfo() . "\n";
print "Logout message: " . $logout->GetLogoutMessage() . "\n";
print "Connect time: " . $logout->GetConnectTime() . "\n";
Example #5
0
<?php

include_once 'librets.php';
$session = new RetsSession("http://demo.crt.realtors.org:6103/rets/login");
if (!$session->Login("Joe", "Schmoe")) {
    print "Invalid Login\n";
    exit(1);
}
$content_type_suffixes = array("image/jpeg" => "jpg", "image/gif" => "gif", "text/xml" => "xml");
$request = new GetObjectRequest("Property", "Photo");
$request->AddAllObjects("LN000001");
$results = $session->GetObject($request);
while ($object_descriptor = $results->NextObject()) {
    $object_key = $object_descriptor->GetObjectKey();
    $object_id = $object_descriptor->GetObjectId();
    $content_type = $object_descriptor->GetContentType();
    $description = $object_descriptor->GetDescription();
    print $object_key . " object #" . $object_id;
    if (strlen($description) > 0) {
        print ", description: " . $description;
    }
    print "\n";
    $suffix = $content_type_suffixes[$content_type];
    $file_name = $object_key . "-" . $object_id . "." . $suffix;
    $file = fopen($file_name, "wb") or die("Unable to create file " . $file_name);
    fwrite($file, $object_descriptor->GetDataAsString());
    fclose($file);
}
$logout = $session->Logout();
print "Billing info: " . $logout->GetBillingInfo() . "\n";
print "Logout message: " . $logout->GetLogoutMessage() . "\n";