我必须使用Rets 服务器从多个资源中检索数据。有什么办法吗?
例如,我有如下资源和类:
- 属性(资源),列表(类)
- 媒体(资源),媒体(类)
应该从第一个中获取一些数据,从第二个中获取一些数据。
我正在使用 Phrets 从 Rets 服务器检索数据。
我正在使用源代码:
<?php
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('Url to connect with')
->setUsername('Username to login')
->setPassword('Password to login');
->setRetsVersion('1.5')
$rets = new \PHRETS\Session($config);
$rets->setLogger($log);
$connect = $rets->Login();
$resource = 'Property';
$class = 'Listing';
$query = "(Acres=0+)";
$options = array(
'Count' => 1,
'Format' => 'COMPACT-DECODED',
'Limit' => 50,
'StandardNames' => 0,
'Select'=>'Acres,City,ClosePrice,BathsFull,BathsHalf,PhotoCount,VirtualTourLink'
);
$results = $rets->Search($resource,$class,$query,$options);
foreach($results as $record){
echo "<table>";
echo "<tr>";
echo "<td>".$record['Acres']."</td> ";
echo "<td>".$record['City']."</td>";
echo "<td>".$record['ClosePrice']."</td>";
echo "<td>".$record['BathsFull']."</td>";
echo "<td>".$record['BathsHalf']."</td>";
echo "<td>".$record['VirtualTourLink']."</td>";
echo "</tr>";
echo "</table>";
}
?>
提前致谢!