rapattoni image url fetch using PHRETS

1,003 views
Skip to first unread message

Johnny

unread,
Jul 1, 2009, 1:28:12 AM7/1/09
to PHRETS
I have successfully used PHRETS to get image urls from sandicor using
code like

$photos = $rets->GetObject("Property", "Photo", "$sysid", '*', 1);
where 'sysid' is in $sysid

Now I'm trying to do the same on a Rapattoni rets server. This server
doesn't have a sysid.
I can get the property data OK but when I do GetObject using the MLS
number for $sysid it $photos = $rets->GetObject("Property", "Photo",
"617582", '*', 1);
var_dump($photos);
returns property data like:
array(15) { [0]=> array(7) { ["Data"]=> string(0) "" ["Content-Type"]
=> string(8) "text/xml" ["Content-ID"]=> string(6) "617582" ["Object-
ID"]=> string(1) "1" ["Content-Description"]=> string(78) "This home
was built by the Garduno family in approx 1948. It is made of
adobe." ["Location"]=> string(0) "" ["Success"]=> bool(true) } [1]
=> array(7) { ["Data"]=> string(0) "" ["Content-Type"]=> string(8)
"text/xml" ["Content-ID"]=> string(6) "617582" ["Object-ID"]=> string
(1) "2" ["Content-Description"]=> string(73) "The front room is
spacious and is graced by vigas, as is the entire home." ["Location"]
=> string(0) "" ["Success"]=> bool(true) } [2]=> array(7) { ["Data"]
=> string(0) "" ["Content-Type"]=> string(8) "text/xml" ["Content-
ID"]=> string(6) "617582" ["Object-ID"]=> string(1) "3" ["Content-
Description"]=> string(0) "" ["Location"]=> string(0) "" ["Success"]
=> bool(true) } etc...

I looked in the meta data to see if I could find a keyfield entry
that might be different but there doesn't seem to be a keyfield entry
so I am at a loss to know what to use since MLS number doesn't bring
back the correct data.

Any help appreciated,
Thanks, J

Troy Davisson

unread,
Jul 1, 2009, 1:41:42 AM7/1/09
to phr...@googlegroups.com
I don't believe Rapattoni supports retrieving back the URLs for photos.  In RETS, the server's support of this feature is optional.

Johnny

unread,
Jul 1, 2009, 1:47:58 AM7/1/09
to PHRETS
Hi Troy,

thanks for the very fast response!
That data I think on re-inspection is descriptions of the images..
I just tried setting location to 0 and some kind of binary file was
sent back so I'll decipher what to do and report back.

Thanks,
Johnny

On Jun 30, 10:41 pm, Troy Davisson <troy.davis...@gmail.com> wrote:
> I don't believe Rapattoni supports retrieving back the URLs for photos.  In
> RETS, the server's support of this feature is optional.
>

Judson Cooper

unread,
Jul 1, 2009, 10:21:09 AM7/1/09
to phr...@googlegroups.com
They may be sending file contents... I am fairly new to this, but also
working on a Rapatonni feed.
--------------------------------------------------------------------------------



No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.375 / Virus Database: 270.13.1/2212 - Release Date: 07/01/09
05:53:00

Troy Davisson

unread,
Jul 1, 2009, 1:35:07 PM7/1/09
to phr...@googlegroups.com
In RETS, a server supporting GetObject must provide back the binary image data (the value of the Data key in what you get back) if requesting Location = 0 (5th parameter on GetObject in PHRETS, defaults to 0).  A server may also support giving back the URL (the value of the Location key in what you get back) if requesting Location = 1.

Judson Cooper

unread,
Jul 3, 2009, 12:54:54 PM7/3/09
to phr...@googlegroups.com
Johnny,

Did ou ever get the photo issue resolved. I am about to try myself.

Thanks,
Judson


----- Original Message -----
From: "Johnny" <jonn...@gmail.com>
To: "PHRETS" <phr...@googlegroups.com>
Sent: Wednesday, July 01, 2009 12:47 AM
Subject: Re: rapattoni image url fetch using PHRETS



Troy Davisson

unread,
Jul 3, 2009, 1:32:39 PM7/3/09
to phr...@googlegroups.com
I don't believe there was an issue to resolve here.

By default, the 5th parameter of GetObject() is set to false which requests that the RETS server returns the actual binary data for each image (which you can then use file_put_contents() to save into a file with a .JPG extension).  If that 5th parameter is included with a value of 1, it will request that the RETS server return back the URL to the photo instead but the RETS server doesn't (by rule) have to support giving back the URL.

If you're getting back the binary image data, it's the Data key in the returned array.  If you're getting back the URL to the object, it's the Location key in the returned array.
Message has been deleted

Johnny

unread,
Jul 5, 2009, 5:43:23 AM7/5/09
to PHRETS
Yes. Sorry to take so long to get back I was buried...
Here's what I did:
$photos = $rets->GetObject("Property", "Photo", "$mlnum", '*', 0);
$picCount = 1;
// write the images retrieved to files
foreach ($photos as $photo) {
if ($photo['Success'] == true) {
// everything is .jpg for this instance
$fileName = $fileRoot . $imageDirectory . $mlnum . '.' .
$picCount . '.jpg';
$fptr = fopen($fileName,'wb');
$len = strlen($photo['Data']);
$bytesWritten = 0;
if ($fptr && $len > 0) {
$bytesWritten = fwrite($fptr,$photo['Data'],$len);
} elseif ($len <1) {
writeLog($mlnum . '.' . $picCount . '.jpg is empty');
}
// fail if $bytesWritten <1
if ($bytesWritten < 1) {
writeLog("write failed to $fileName");
} else {
writeLog("$bytesWritten bytes written for file $mlnum.
$picCount.jpg");
$picCount++;
}
if ($fptr) {
fclose($fptr);
}
if ($picCount > $maxPicCount){ // max number of pics to save
writeLog(" breaking as picount=$picCount > maxPicCount=
$maxPicCount");
break;

Judson Cooper

unread,
Jul 10, 2009, 1:21:28 PM7/10/09
to phr...@googlegroups.com
Johhny,

Have you figured out how to use Status in the search filter?

Doing...

$search =
$rets->Search("Property","RESI","(MLNumber=0+),(EntryDate=2008-01-01+),(Status=A)",
array("Limit" => 50));


Gives me:
"Invalid Query Syntax. The syntax for the field: Status does not match its
search type."

I have tried Active, ACT, even numbers....

Thanks,
Judson


----- Original Message -----
From: "Johnny" <jonn...@gmail.com>
To: "PHRETS" <phr...@googlegroups.com>
Sent: Sunday, July 05, 2009 4:38 AM
Subject: Re: rapattoni image url fetch using PHRETS



Yes. Sorry to take so long to get back I was buried...
Here's what I did:
$photos = $rets->GetObject("Property", "Photo", "$mlnum", '*', 0);
$picCount = 1;
// write the images retrieved to files
foreach ($photos as $photo) {
if ($photo['Success'] == true) {
// everything is .jpg for this instance
$fileName = $fileRoot . $imageDirectory . $mlnum . '.' .
$picCount . '.jpg';
$fptr = fopen($fileName,'wb');
$len = strlen($photo['Data']);
$bytesWritten = 0;
if ($fptr && $len > 0) {
$bytesWritten = fwrite($fptr,$photo['Data'],$len);
} elseif ($len <1) {
writeLog($mlnum . '.' . $picCount . '.jpg is empty');
}
// more error handling and messages below here.
}


On Jul 3, 9:54 am, "Judson Cooper" <jud...@jntwebdesigns.com> wrote:
Version: 8.5.386 / Virus Database: 270.13.4/2218 - Release Date: 07/04/09
17:55:00

Troy Davisson

unread,
Jul 10, 2009, 1:30:32 PM7/10/09
to phr...@googlegroups.com
Take a peak at http://retsmd.com/

Find the Status field.  You'll want the SystemName of that field (which is probably Status but double check).  On the right, there will be a values link.  In the popup, you want the "Value" (far left) next to the status you're interested in.  The name and lookup need to go together with an equal size and pipe between them.

All together now....:

(Status=|Value)

so maybe (Status=|ACTIVE) or (Status=|A)

If the field you're searching is a Lookup, you need the =| rather than = .

Judson Cooper

unread,
Jul 10, 2009, 1:44:20 PM7/10/09
to phr...@googlegroups.com
Troy,
 
That was what I a was missing, the pipe.... thanks. That link is invaluable.
 
Judson


No virus found in this incoming message.
Checked by AVG - www.avg.com

Version: 8.5.387 / Virus Database: 270.13.9/2229 - Release Date: 07/10/09 07:05:00

Nick Serra

unread,
Aug 9, 2009, 6:11:23 PM8/9/09
to PHRETS
I can't believe they don't support urls for photos. I've been on their
mls listing for a while trying to find a pattern in their image
hosting so i don't have to save each picture to the server for the
queries. I'm probably going to be giving them a call on monday to see
what options they have.

On Jul 10, 1:44 pm, "Judson Cooper" <jud...@jntwebdesigns.com> wrote:
> Troy,
>
> That was what I a was missing, the pipe.... thanks. That link is invaluable.
>
> Judson
>
>   ----- Original Message -----
>   From: Troy Davisson
>   To: phr...@googlegroups.com
>   Sent: Friday, July 10, 2009 12:30 PM
>   Subject: Re: rapattoni image url fetch using PHRETS
>
>   Take a peak athttp://retsmd.com/
> ------------------------------------------------------------------------------
>
>   No virus found in this incoming message.
>   Checked by AVG -www.avg.com

Mark Optimal

unread,
Jul 8, 2015, 9:02:38 AM7/8/15
to phr...@googlegroups.com
Hi,

I am having problem with sysid. I did not find anywhere this type of keyword in any property listing. So can you suggest which field value would be for sysid in phrets GetObject()?

Below keywords I am getting by SearchQuery() but I am unable to get property related images through phrets GetObject(). Can you help me?

[APN] => 6009021008
            [AccessibilityFeatures] => 
            [Acres] => 0.029
            [AdNumber] => 
            [Appliances] => 
            [AppliancesYN] => 
            [Area] => C42 - Downtown L.A.
            [Assessments] => Unknown
            [AssessmentsYN] => 1
            [Association] => 
            [AssociationDues1] => 0
            [AssociationDues1Frequency] => 
            [AssociationDues2] => 0
            [AssociationDues2Frequency] => 
            [AssociationName1] => 
            [AssociationYN] => 0
            [AttachedStructure] => 
            [BasementSqft] => 
            [BathsFull] => 1
            [BathsHalf] => 0
            [BathsOqtr] => 0
            [BathsTotal] => 1.00
            [BathsTqtr] => 0
            [Bedrooms] => 3
            [BuildersName] => 
            [BuildersTractCode] => NAC42
            [BuildersTractName] => NAC42
            [CDOM] => 69
            [CDOMResetYN] => 
            [COLA_Board] => 
            [COLA_FirstName] => 
            [COLA_LastName] => 
            [COLA_PublicID] => 
            [COLA_StateLicenseNumber] => 
            [COLO_Code] => 
            [COLO_Name] => 
            [COSA_FirstName] => 
            [COSA_LastName] => 
            [COSA_PublicID] => 
            [COSA_StateLicenseNumber] => 
            [COSO_Code] => 
            [COSO_Name] => 
            [City] => Los Angeles
            [CommonWalls] => 
            [CommunityFeatures] => 
            [ConstructionMaterials] => Stucco
            [ContactOrder1] => 
            [ContactOrder2] => 
            [ContactOrder3] => 
            [ContactOrder4] => 
            [ContactOrder5] => 
            [ContactOrder6] => 
            [Cooling] => 
            [CoolingYN] => 
            [Country] => 
            [County] => Los Angeles
            [CrossStreets] => West of Alameda So of Gage
            [DOH1] => 
            [DOH2] => 
            [DOH3] => 
            [DOM] => 2
            [DateClosedSale] => 
            [DateCmaStatus] => 2015-07-06 00:00:00
            [DateListingContract] => 2015-07-06 00:00:00
            [DeletedYN] => 0
            [DirectionFaces] => 
            [Directions] => 
            [Disclosures] => 
            [DocumentNumber] => 
            [DoorFeatures] => 
            [EatingArea] => 
            [Elevation] => 
            [EntryLevel] => 
            [EntryLocation] => 
            [ExteriorFeatures] => 
            [FenceYN] => 
            [Fencing] => 
            [Fireplace] => 
            [FireplaceYN] => 0
            [Floor] => 
            [Foundation] => 
            [GarageAttached] => 
            [GreenBuildingCertification] => 
            [GreenCertificationRating] => 
            [GreenCertifyingBody] => 
            [GreenEnergyEfficient] => 
            [GreenEnergyGeneration] => 
            [GreenIndoorAirQuality] => 
            [GreenLocation] => 
            [GreenSustainability] => 
            [GreenWalkScore] => 
            [GreenWaterConservation] => 
            [GreenYearCertified] => 
            [Heating] => 
            [HeatingYN] => 
            [InteriorFeatures] => 
            [InternetSendAddressYN] => 1
            [InternetSendListingYN] => 1
            [LA_Board] => Glendale
            [LA_FirstName] => Sidney
            [LA_LastName] => Manzo
            [LA_Publicid] => ITC-G165111365
            [LA_StateLicenseNumber] => 01108914
            [LO_Code] => ITC-G6535
            [LO_Name] => Re/Max Tri-City Realty
            [LandFeeLease] => Fee
            [LastChangeType] => New Listing
            [Laundry] => 
            [LaundryYN] => 
            [License1] => 
            [License2] => 
            [License3] => 
            [ListPrice] => 199000
            [ListPriceIncludes] => 
            [ListPriceLow] => 
            [ListingKey] => 10055802
            [LotDimensions] => 
            [LotFeatures] => 
            [LotSquareFootage] => 1273
            [MLSID] => ITECH
            [MLnumber] => 315006732
            [Make] => 
            [NumberCarportSpaces] => 0
            [NumberGarageSpaces] => 0
            [NumberParkingSpaces] => 0
            [NumberRemotes] => 0
            [NumberUncoveredSpaces] => 
            [NumberUnits] => 0
            [OtherStructures] => 
            [Parking] => 
            [ParkingYN] => 
            [Patio] => 
            [PatioYN] => 
            [Piccount] => 7
            [Pool] => 
            [PoolYN] => 0
            [PostalCode] => 90001
            [PostalCodePlus4] => 2114
            [PreviousPrice] => 
            [PreviousStatus] => 
            [PricePerSqft] => 256.44
            [PropertyDescription] => Great opportunity!!!! This home has just been upgraded and features 3 bedrooms and one full bath and is  conveniently located close to shopping and transportation.
            [PropertySubType] => Single Family Residence
            [RVAccessDimensions] => 
            [Roofing] => Shingle,Composition
            [Rooms] => 
            [SA_FirstName] => 
            [SA_LastName] => 
            [SA_PublicID] => 
            [SA_StateLicenseNumber] => 
            [SO_Code] => 
            [SO_Name] => 
            [SaleType] => Standard
            [SchoolDistrict] => 
            [SchoolElementary] => 
            [SchoolHigh] => 
            [SchoolJuniorHigh] => 
            [SecurityFeatures] => 
            [SellingPrice] => 0
            [SeniorYN] => 
            [SerialU] => 
            [SerialX] => 
            [SerialXX] => 
            [Sewer] => 
            [ShowingContactName] => 
            [ShowingContactPhone] => 
            [ShowingContactPhoneExt] => 
            [ShowingContactType] => 
            [SourceKey] => 94310630
            [SourceTimestampModified] => 
            [Spa] => 
            [SpaYN] => 0
            [SprinklersYN] => 
            [SqFtSourceLot] => Assessor's Data
            [SqFtSourceStructure] => Assessor's Data
            [SquareFootageStructure] => 776
            [State] => CA
            [Status] => Active
            [Stories] => One Level
            [StoriesTotal] => 0
            [StreetDirection] => East
            [StreetDirectionSuffix] => 
            [StreetName] => 66th
            [StreetNumber] => 1815
            [StreetNumberModifier] => 
            [StreetSuffix] => Street
            [StreetSuffixModifier] => 
            [StructuralCondition] => 
            [Style] => 
            [ThomasGuide] => 674G7
            [TimestampModified] => 2015-07-06 20:46:57
            [TimestampOffMarket] => 
            [TimestampPhotoModified] => 2015-07-06 12:24:27
            [TimestampStatusChange] => 2015-07-06 12:16:26
            [TractName] => 
            [TractNumber] => 
            [TractSubAreaCode] => 
            [UnitNumber] => 
            [Utilities] => 
            [View] => 
            [ViewYN] => 0
            [VirtualTour] => 
            [WaterSource] => 
            [WellDepth] => 
            [WellGallonsPerMinute] => 
            [WellPumpHorsepower] => 
            [WellReportYN] => 
            [WindowFeatures] => 
            [YearBuilt] => 1923
            [YearBuiltSource] => 
            [Zone] => LCC2*

Gennadiy Kofman

unread,
Jul 8, 2015, 1:31:34 PM7/8/15
to phr...@googlegroups.com
Some rets use the mls number.  Try MLnumber.

If that doesn't work, try SourceKey.  I don't know what it is, but it looks like it could be the unique id.
Reply all
Reply to author
Forward
0 new messages