简体   繁体   English

PHP中的RETS数据获取Feed的问题

[英]Issue With RETS Data Fetching Feed in PHP

I am using the PHRETS PHP library to fetch the RETS data from the rets API. 我正在使用PHRETS PHP库从rets API获取RETS数据。 I have and issue with getting the Data. 我有获取数据的问题。 It's giving me the Requested Class not found Error. 它给了我Requested Class not found错误。 Please help to solve this Error. 请帮助解决此错误。 My Code is: 我的代码是:

date_default_timezone_set('America/New_York');

require_once("vendor/autoload.php");

$log = new \Monolog\Logger('PHRETS');
$log->pushHandler(new \Monolog\Handler\StreamHandler('php://stdout', \Monolog\Logger::DEBUG));



$config = new \PHRETS\Configuration;
$config->setLoginUrl('http://rets.navicamls.net/login.aspx')
        ->setUsername('xxx')
        ->setPassword('xxx')
        ->setRetsVersion('1.7.2');

$rets = new \PHRETS\Session($config);
$rets->setLogger($log);

$connect = $rets->Login();


if ($connect) {
 echo "Connected!<br>";
}
else {
 echo "Not Connected!<br>";
 print_r($rets->Error());
 exit;
}


//results consists of Property, class, and query
$results = $rets->Search(
    "Property",
    "A",
    "*",
    [
        'QueryType' => 'DMQL2',
        'Count' => 1, // count and records
        'Format' => 'COMPACT-DECODED',
        'Limit' => 10,
        'StandardNames' => 0, // give system names
    ]
);

print_r($results); exit;

You need to first verify the name of the class in your search query is correct by looking up the metadata. 您首先需要通过查找元数据来验证搜索查询中类的名称是否正确。

  1. Use RETSMD.com and enter the RETS Server login url, username, and password. 使用RETSMD.com并输入RETS Server登录URL,用户名和密码。
  2. Use the metadata functions in the PHRETS documentation on the main page 使用主页上的PHRETS文档中的元数据功能

    a. 一种。 $system = $rets->GetSystemMetadata(); $ system = $ rets-> GetSystemMetadata();

    b. $classes = $rets->GetClassesMetadata('Property'); $ classes = $ rets-> GetClassesMetadata('Property');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM