编程语言
首页 > 编程语言> > php – 为什么搜索查询没有在PHRETS中显示任何结果?

php – 为什么搜索查询没有在PHRETS中显示任何结果?

作者:互联网

我正在使用这个PHP脚本从一个简单的搜索查询获得结果here

我已经下载了属性here的元数据excel文件

$rets_login_url = "http://sef.rets.interealty.com/Login.asmx/Login";
$rets_username = "xxxxxxxx";
$rets_password = "xxxxxxxx";
$rets_user_agent = "PHRETS/1.0";
$rets_user_agent_password = "xxxxxxx";

//////////////////////////////

// start rets connection
$rets = new phRETS;
// Uncomment and change the following if you're connecting
// to a server that supports a version other than RETS 1.5

$rets->AddHeader("RETS-Version", "RETS/1.5");

$rets->AddHeader("User-Agent", $rets_user_agent);

echo "+ Connecting to {$rets_login_url} as {$rets_username}<br>\n";
$connect = $rets->Connect($rets_login_url, $rets_username, $rets_password, $rets_user_agent_password);

// check for errors
if ($connect) {
        echo "  + Connected<br>\n";
}
else {
        echo "  + Not connected:<br>\n";
        print_r($rets->Error());
        exit;
}

$search = $rets->SearchQuery("Property","ResidentialProperty","(ListDate=1990-01-01+)");
while ($listing = $rets->FetchRow($search)) {
   echo "Address: {$listing['StreetNumber']} {$listing['StreetName']}, ";
   echo "{$listing['City']}, ";
   echo "{$listing['State']} {$listing['ZipCode']} listed for ";
   echo "\$".number_format($listing['ListPrice'])."\n";
}


$rets->FreeResult($search);

echo "+ Disconnecting<br>\n";
$rets->Disconnect();

当我运行此脚本时,它显示连接的结果,然后断开连接.但没有找到结果.我试了很多关于结果没有显示的问题的建议,但没有什么对我有用.哪里错了?

我的RETS服务器信息在这里:

RETS服务器:SEF RETS系统
RETS系统ID:SEFRETS
登录URL:http://sef.rets.interealty.com:80/Login.asmx/Login
RETS版本:1.5
服务器软件:Microsoft-IIS / 6.0

我也无法理解什么是$rets_modtimestamp_field =“LIST_87”;

请帮我.我需要一些关于如何从RETS获取数据的建议.

解决方法:

问题在于SearchQuery中的参数.

搜索查询中的一个字段是ListDate.查看包含元数据的附加excel文件,“ListDate”位于StandardNames下的B列中. RETS specification使用系统名称作为默认值(见下文).您需要指定’“StandardNames”=> SearchQuery函数的options参数中的1’:

$search = $rets-> SearchQuery(“Property”,“ResidentialProperty”,“(ListDate = 1990-01-01)”,array(“StandardNames”=> 1));

另外,请检查以确保SearchQuery的第二个参数class是正确的.为此,您可以在PHRETS中使用GetMetadataClasses功能.
您还可以使用RETS服务器URL,用户名和密码登录来使用retsmd.com.

$rets_modtimestamp_field是一个字段,它是一个日期时间值,指示上次修改列表的日期和时间.

在RETS 1.7.2规范文件http://www.reso.org/assets/RETS/Specifications/rets_1_7_2.pdf的7.4.7节中,

“查询可以在查询中使用标准名称或系统名称(第7.7节)
客户端选择使用标准名称,它必须使用StandardNames来指示
参数…如果此条目设置为(“0”)或不存在,则搜索中传递的字段名称为
SystemNames,在元数据中定义.“

标签:php,rets
来源: https://codeday.me/bug/20190628/1319260.html