Phrets使用getobject

时间:2017-12-04 14:54:11

标签: php phrets

任何人都可以帮助我如何使用reso phrets获取财产图像。

以下是我正在执行的代码:

$rets   = new \PHRETS\Session($config);
$search = $rets->Search("Property","Residential","*",
    array( 
        'QueryType'           => 'DMQL2',
        "Count"               => 1,
        "Format"              => "COMPACT-DECODED",
        "Limit"               => 5,
        "Offset"              => 0,
        "Select"              => "ListingKeyNumeric,BuyerAgentLastName,buyerAgentFirstName,buyerOfficeName,City,Country,CurrentPrice,StreetName,PostalCode,StateOrProvince,StreetNumberNumeric,BedroomsTotal,BathroomsTotalInteger,LotSizeSquareFeet,YearBuilt,StandardStatus,LotSizeAcres,ListOfficeMlsId,ListPrice,BathroomsFull,BathroomsHalf,PropertySubType,ArchitecturalStyle,MLSAreaMajor,CountyOrParish,Utilities,ParkingTotal,ParkingFeatures,GarageSpaces,View,PoolPrivateYN,PoolFeatures,InteriorFeatures,Appliances,Heating,Cooling,FireplaceYN,FireplaceFeatures,StoriesTotal,ExteriorFeatures,LotSizeDimensions,WindowFeatures,Roof,ConstructionMaterials,FoundationDetails,HighSchoolDistrict,ElementarySchool,MiddleOrJuniorSchool,OriginalEntryTimestamp,DaysOnMarket,Zoning,AssociationFee,AssociationFeeFrequency,ListOfficeName,PricePerSquareFoot,ListAgentFirstName,ListAgentLastName,ListAgentMlsId,InternetAddressDisplayYN,ListingId,PhotosCount",
        "RestrictedIndicator" => "****",
        "StandardNames"       => 1 
    )
);

foreach ($search as $r) {

    $rets_resource = 'Property';
    $object_type   = 'photo';
    $listing_id    = $r['ListingId'];
    $photos        = $rets->GetObject('Property',$classes->first()->getClassName(),'OC17206923,217009806DA,PW17081942','*',0);
    print_r($photos);
}

结果我得到了什么:

Illuminate\Support\Collection Object
(    [items:protected] => Array
    (
      [0] => PHRETS\Models\Object Object
      (
       [content_type:protected] => text/xml
       [content_id:protected] => 
       [object_id:protected] => 
       [mime_version:protected] => 1.0
       [location:protected] => 
       [content_description:protected] => 
       [content_sub_description:protected] => 
       [content:protected] => 

       [preferred:protected] => 
       [error:protected] => PHRETS\Models\RETSError Object
      (
        [code:protected] => 20401
        [message:protected] => Invalid Type
      )
    )
  )
)

2 个答案:

答案 0 :(得分:0)

getObject()调用中type参数的 $ classes-> first() - > getClassName()的值是什么?

也许您想要使用照片'或者$ object_type?

答案 1 :(得分:0)

给getObject()方法的第二个参数是错误的。您正在尝试提供类名,而不是对象类型。

查看此phrets getObject()文档以供参考。

需要像这样更改您的代码,

$photos        = $rets->GetObject('Property',$object_type,'OC17206923,217009806DA,PW17081942','*',0);

此外,您可以使用“1”更改最后一个参数以单独获取图像网址。所有MLS可能都不支持此选项。