背景信息
KeyField
ml_num
我运行的代码
$photos = $rets->GetObject("Property", "Photo", "N3273704", "*", 0);
var_dump($photos);
foreach ($photos as $photo) {
$listing = $photo['Content-ID'];
$number = $photo['Object-ID'];
if ($photo['Success'] == true) {
file_put_contents("image-{$listing}-{$number}.jpg", $photo['Data']);
} else {
echo "({$listing}-{$number}): {$photo['ReplyCode']} = {$photo['ReplyText']}\n";
}
}
原始头和响应
[2015-07-29 13:16:09] PHRETS.DEBUG: Sending HTTP Request for http://rets.torontomls.net:6103/rets-treb3pv/server/getobject (GetObject) {"query":{"Resource":"Property","Type":"Photo","ID":"N3273704:*","Location":0},"headers":{"User-Agent":"PHRETS/2.0","RETS-Version":"RETS/1.5","Accept-Encoding":"gzip"},"cookies": ..."]} []
[2015-07-29 13:16:09] PHRETS.DEBUG: Response: HTTP 200 [] []
屏幕上的输出(var_dump的结果)
array(20) {
[0]=>
object(PHRETS\Models\Object)#32 (10) {
["content_type":protected]=>
string(8) "text/xml"
["content_id":protected]=>
string(4) "null"
["object_id":protected]=>
string(4) "null"
["mime_version":protected]=>
NULL
["location":protected]=>
NULL
["content_description":protected]=>
NULL
["content_sub_description":protected]=>
NULL
["content":protected]=>
string(192) "<?xml version="1.0" standalone="no"?>
<!DOCTYPE RETS SYSTEM "RETS-20041001.dtd">
<RETS ReplyCode="20403" ReplyText="No Object Found: No matching object was found to satisfy the request."/>"
["preferred":protected]=>
NULL
["error":protected]=>
object(PHRETS\Models\RETSError)#45 (2) {
["code":protected]=>
int(20403)
["message":protected]=>
string(69) "No Object Found: No matching object was found to satisfy the request."
}
}
[1]=> ...
发布于 2015-08-06 13:46:57
我能够解决这个问题,我写这篇文章是希望它能节省一些人的时间。
在监视HTTP流量并比较从Windows应用程序PHRETS和RETS连接器发送的原始标头之后,发现一些RETS服务器(在本例中是多伦多房地产委员会)需要“接受”字段出现在报头中。因此,通过在Session类的构造函数中添加以下行来解决这个问题:
'Accept' => '*/*',
发布于 2015-10-09 03:22:25
我想写一个音符..。TREB的KeyField配置错误。他们使用属性标识字段( DBName )的ml_num版本,而KeyField则被认为是该字段(ml_num)的SystemName版本.只是情况不同而已,但对于RETS客户端来说,这是一个巨大的变化,它将自动从RETS元数据中派生出KeyField。
https://stackoverflow.com/questions/31712979
复制相似问题