I'm trying to access the Rets data using Standard-XML but Phrets 1.0.1 is not returning any data. This is opposed to using Compact-Decoded which works great.
To illustrate the problem, I'm using your CSV output sample code from the wiki. Below is that sample PHP code as well as the plain XML data that I've been able to access by logging the last request.
If you need my rets / crea credentials, happy to share them privately through email.
Thanks for your help.
<?php
$rets_login_url = "http://data.crea.ca/Login.svc/Login";
$rets_username = ""; // redacted
$rets_password = ""; // redacted
// Sample data
//$rets_login_url = 'http://sample.data.crea.ca/Login.svc/Login';
//$rets_username = 'CXLHfDVrziCfvwgCuL8nUahC';
//$rets_password = 'mFqMsCSPdnb5WO1gpEEtDCHH';
// use http://retsmd.com to help determine the names of the classes you want to pull.
// these might be something like RE_1, RES, RESI, 1, etc.
$property_classes = array("Property");
//////////////////////////////
require_once("phrets.php");
// start rets connection
$rets = new phRETS;
echo "+ Connecting to {$rets_login_url} as {$rets_username}<br>\n";
$connect = $rets->Connect($rets_login_url, $rets_username, $rets_password);
if ($connect) {
echo " + Connected<br>\n";
}
else {
echo " + Not connected:<br>\n";
print_r($rets->Error());
exit;
}
foreach ($property_classes as $class) {
echo "+ Property:{$class}<br>\n";
$file_name = strtolower("property_{$class}.csv");
$fh = fopen($file_name, "w+");
$maxrows = true;
$offset = 1;
$limit = 'None';
$fields_order = array();
while ($maxrows) {
//$query = "ID=*";
$query = "ID=13560156";
// run RETS search
echo " + Query: {$query} Limit: {$limit} Offset: {$offset}<br>\n";
$search = $rets->SearchQuery("Property", $class, $query, array('Limit' => $limit, 'Offset' => $offset, 'Format' => 'STANDARD-XML', 'Count' => 1));
if ($rets->NumRows() > 0) {
if ($offset == 1) {
// print filename headers as first line
$fields_order = $rets->SearchGetFields($search);
fputcsv($fh, $fields_order);
}
// process results
while ($record = $rets->FetchRow($search)) {
$this_record = array();
foreach ($fields_order as $fo) {
$this_record[] = $record[$fo];
}
fputcsv($fh, $this_record);
}
$offset = ($offset + $rets->NumRows());
}
$maxrows = $rets->IsMaxrowsReached();
echo " + Total found: {$rets->TotalRecordsFound()}<br>\n";
$rets->FreeResult($search);
}
fclose($fh);
echo " - done<br>\n";
}
echo "+ Disconnecting<br>\n";
$rets->Disconnect();
<?xml version="1.0" encoding="UTF-8"?>
<RETS ReplyCode="0" ReplyText="Operation successful">
<RETS-RESPONSE xmlns="CREA.Search.Property">
<Pagination>
<TotalRecords>1</TotalRecords>
<Limit>10</Limit>
<Offset>1</Offset>
<TotalPages>1</TotalPages>
<RecordsReturned>1</RecordsReturned>
</Pagination>
<PropertyDetails ID="13560156" LastUpdated="Mon, 09 Sep 2013 13:42:14 GMT">
<ListingID>1306586</ListingID>
<AgentDetails ID="1460791">
<Name>PEGGY HILL</Name>
<Phones>
<Phone ContactType="Business" PhoneType="Telephone">(705) 739-4455</Phone>
<Phone ContactType="Business" PhoneType="Fax">(705) 733-2200</Phone>
</Phones>
<Websites>
<Website ContactType="Business" WebsiteType="Website">http://peggyhill.com/content/listings2</Website>
<Website ContactType="Business" WebsiteType="FaceBook">http://www.facebook.com/ThePeggyHillTeamBarrie</Website>
<Website ContactType="Business" WebsiteType="LinkedIn">http://www.linkedin.com/company/peggy-hill-&-associates-realty-inc</Website>
<Website ContactType="Business" WebsiteType="Twitter">HTTP://TWITTER.COM/#!/PEGHILLREALTOR</Website>
</Websites>
<Office ID="272203">
<Name>KELLER WILLIAMS EXPERIENCE REALTY, BROKERAGE</Name>
<Address>
<StreetAddress>431 HURONIA ROAD|UNIT 13</StreetAddress>
<AddressLine1>431 HURONIA ROAD</AddressLine1>
<Addressline2>UNIT 13</Addressline2>
<City>BARRIE</City>
<PostalCode>L4N9B3</PostalCode>
</Address>
<Phones>
<Phone ContactType="Business" PhoneType="Telephone">(705) 720-2200</Phone>
<Phone ContactType="Business" PhoneType="Fax">(705) 733-2200</Phone>
</Phones>
<Websites>
<Website ContactType="Business" WebsiteType="Website">http://www.KW-Experience.com</Website>
</Websites>
</Office>
<Position>Broker</Position>
</AgentDetails>
<AgentDetails ID="1452910">
<Name>TERRY LAYCOCK SCHNEIDER</Name>
<Phones>
<Phone ContactType="Business" PhoneType="Telephone">(705) 791-8911</Phone>
<Phone ContactType="Business" PhoneType="Fax">(705) 733-2200</Phone>
</Phones>
<Websites>
<Website ContactType="Business" WebsiteType="Website">http://www.yourhomeline.com</Website>
</Websites>
<Office ID="272203">
<Name>KELLER WILLIAMS EXPERIENCE REALTY, BROKERAGE</Name>
<Address>
<StreetAddress>431 HURONIA ROAD|UNIT 13</StreetAddress>
<AddressLine1>431 HURONIA ROAD</AddressLine1>
<Addressline2>UNIT 13</Addressline2>
<City>BARRIE</City>
<PostalCode>L4N9B3</PostalCode>
</Address>
<Phones>
<Phone ContactType="Business" PhoneType="Telephone">(705) 720-2200</Phone>
<Phone ContactType="Business" PhoneType="Fax">(705) 733-2200</Phone>
</Phones>
<Websites>
<Website ContactType="Business" WebsiteType="Website">http://www.KW-Experience.com</Website>
</Websites>
</Office>
<Position>Broker</Position>
</AgentDetails>
<Board>17</Board>
<Business>
<Franchise>False</Franchise>
</Business>
<Building>
<BathroomTotal>3</BathroomTotal>
<BedroomsTotal>2</BedroomsTotal>
<Age>11 to 20 years</Age>
<Appliances>Jacuzzi, Central Vacuum, Water softener</Appliances>
<BasementDevelopment>Finished</BasementDevelopment>
<BasementType>Full</BasementType>
<ConstructedDate>10 years</ConstructedDate>
<ConstructionStyleAttachment>Detached</ConstructionStyleAttachment>
<CoolingType>Central air conditioning</CoolingType>
<DisplayAsYears>1</DisplayAsYears>
<ExteriorFinish>Brick</ExteriorFinish>
<FireplaceFuel>Gas</FireplaceFuel>
<FireplacePresent>True</FireplacePresent>
<FireplaceType>Conventional</FireplaceType>
<Fixture>Drapes/Window coverings</Fixture>
<FlooringType>Hardwood, Laminate</FlooringType>
<FoundationType>Poured Concrete</FoundationType>
<HeatingFuel>Natural gas</HeatingFuel>
<HeatingType>Forced air,Radiant heat</HeatingType>
<Rooms>
<Room>
<Type>Living room</Type>
<Width>5.31 m</Width>
<Length>3.64 m</Length>
<Level>Second level</Level>
<Dimension>3.64 m x 5.31 m</Dimension>
</Room>
<Room>
<Type>Dining room</Type>
<Width>4.15 m</Width>
<Length>3.64 m</Length>
<Level>Second level</Level>
<Dimension>3.64 m x 4.15 m</Dimension>
</Room>
<Room>
<Type>Kitchen</Type>
<Width>2.22 m</Width>
<Length>3.53 m</Length>
<Level>Second level</Level>
<Dimension>3.53 m x 2.22 m</Dimension>
</Room>
<Room>
<Type>Master bedroom</Type>
<Width>5.47 m</Width>
<Length>3.63 m</Length>
<Level>Second level</Level>
<Dimension>3.63 m x 5.47 m</Dimension>
</Room>
<Room>
<Type>Full ensuite bathroom</Type>
<Width />
<Length />
<Level>Second level</Level>
<Dimension>n/a</Dimension>
</Room>
<Room>
<Type>Bedroom 2</Type>
<Width>3.22 m</Width>
<Length>4.27 m</Length>
<Level>Second level</Level>
<Dimension>4.27 m x 3.22 m</Dimension>
</Room>
<Room>
<Type>Full bathroom</Type>
<Width />
<Length />
<Level>Second level</Level>
<Dimension>n/a</Dimension>
</Room>
<Room>
<Type>Recreational, Games room</Type>
<Width>9.59 m</Width>
<Length>3.64 m</Length>
<Level>Main level</Level>
<Dimension>3.64 m x 9.59 m</Dimension>
</Room>
<Room>
<Type>Partial bathroom</Type>
<Width />
<Length />
<Level>Main level</Level>
<Dimension>n/a</Dimension>
</Room>
<Room>
<Type>Laundry room</Type>
<Width />
<Length />
<Level>Main level</Level>
<Dimension>n/a</Dimension>
</Room>
</Rooms>
<SizeExterior />
<SizeInterior>132 m2</SizeInterior>
<StoriesTotal>1</StoriesTotal>
<Type>House</Type>
<Uffi>No never present</Uffi>
<UtilityWater>Municipal water</UtilityWater>
</Building>
<Land>
<SizeTotalText>35.5X55.9XIRR M (116.6X180FT)|1/2 - 1 acre</SizeTotalText>
<SizeFrontage />
<Acreage>false</Acreage>
<Amenities>Golf Course, Ski area</Amenities>
<FenceTotal />
<LandscapeFeatures>Landscaped, Underground sprinkler</LandscapeFeatures>
<Sewer>Septic System</Sewer>
<SizeIrregular>35.5X55.9XIRR M (116.6X180FT)</SizeIrregular>
</Land>
<Address>
<StreetAddress>70 DAVENPORT DR</StreetAddress>
<AddressLine1>70 DAVENPORT DR</AddressLine1>
<City>HILLSDALE</City>
<Province>Ontario</Province>
<PostalCode>L0L1V0</PostalCode>
<Country>Canada</Country>
</Address>
<AlternateURL>
<BrochureLink>http://peggyhill.com/listings/1306586</BrochureLink>
<MapLink>https://maps.simcoe.ca/Advanced/RealEstate/viewer.aspx?Site=SCRealEstate&ReloadKey=True&MapResource=DynamicUnSecured&LayerName=Property For Sale (polygon)&FieldName=MLSNO&FieldValues=1306586</MapLink>
<SoundLink>http://www.youtube.com/embed/8sBzOcUcmPE?rel=0</SoundLink>
<VideoLink>http://www.youtube.com/embed/8sBzOcUcmPE?rel=0</VideoLink>
</AlternateURL>
<AmmenitiesNearBy>Golf Course, Ski area</AmmenitiesNearBy>
<Features>Treed, Wooded area</Features>
<ParkingSpaces>
<Parking>
<Name>Garage</Name>
</Parking>
<Parking>
<Name>Attached garage</Name>
</Parking>
</ParkingSpaces>
<Photo>
<PropertyPhoto>
<SequenceId>1</SequenceId>
<LastUpdated>21/08/2013 3:43:11 PM</LastUpdated>
</PropertyPhoto>
<PropertyPhoto>
<SequenceId>2</SequenceId>
<LastUpdated>21/08/2013 3:43:11 PM</LastUpdated>
</PropertyPhoto>
<PropertyPhoto>
<SequenceId>3</SequenceId>
<LastUpdated>21/08/2013 3:43:11 PM</LastUpdated>
</PropertyPhoto>
<PropertyPhoto>
<SequenceId>4</SequenceId>
<LastUpdated>21/08/2013 3:43:11 PM</LastUpdated>
</PropertyPhoto>
<PropertyPhoto>
<SequenceId>5</SequenceId>
<LastUpdated>21/08/2013 3:43:11 PM</LastUpdated>
</PropertyPhoto>
<PropertyPhoto>
<SequenceId>6</SequenceId>
<LastUpdated>21/08/2013 3:43:11 PM</LastUpdated>
</PropertyPhoto>
<PropertyPhoto>
<SequenceId>7</SequenceId>
<LastUpdated>21/08/2013 3:43:11 PM</LastUpdated>
</PropertyPhoto>
<PropertyPhoto>
<SequenceId>8</SequenceId>
<LastUpdated>21/08/2013 3:43:11 PM</LastUpdated>
</PropertyPhoto>
<PropertyPhoto>
<SequenceId>9</SequenceId>
<LastUpdated>21/08/2013 3:43:11 PM</LastUpdated>
</PropertyPhoto>
<PropertyPhoto>
<SequenceId>10</SequenceId>
<LastUpdated>21/08/2013 3:43:11 PM</LastUpdated>
</PropertyPhoto>
<PropertyPhoto>
<SequenceId>11</SequenceId>
<LastUpdated>21/08/2013 3:43:11 PM</LastUpdated>
</PropertyPhoto>
<PropertyPhoto>
<SequenceId>12</SequenceId>
<LastUpdated>21/08/2013 3:43:11 PM</LastUpdated>
</PropertyPhoto>
</Photo>
<Price>374900.00</Price>
<PropertyType>Single Family</PropertyType>
<PublicRemarks>Welcome to 70 Davenport Drive! A hidden gem in the quaint town of Hillsdale where winding tree-lined streets lead you to an impeccably cared for fully finished 2,000+ sq. foot all brick raised bungalow. Experience the best of both worlds while living in a private setting with the luxury of commuter routes, skiing, exclusive golf, parks, schools, local shopping being minutes away. Curb appeal plus with parking for 6 cars, paved driveway, turret style front, double wide entry and beautiful mature trees. Inside, the large Foyer has ceramic floors, custom oak railings and staircase and leads up to the main living space. The open concept Living Room and Dining Room have hardwood maple floors, neutral paint, palladium window, coffered ceiling with lighting, and a fabulous 3 sided Napoleon gas fireplace with water feature and custom walnut top. A chef's delight is the Kitchen with oversized double door pantry with stainless steel shelving, maple cabinets with built in wine glass rack, 3 stainless appliances and an over range microwave and French doors. Two Bedrooms have eco-friendly bamboo floors, neutral paint, double closets, custom blinds. The Master Suite has a 5 piece Ensuite with glass door shower, corner Jacuzzi tub and his and hers sinks. Rounding off this floor is the Main 4 piece Bathroom. Downstairs is fully finished with space enough to add another Bedroom but currently has an Entertainment zone, home office & fitness area, water softener & UV filter. Thoughtful inclusions are laminate floors, radiant heat throughout the lower level, huge bright windows, neutral paint, 2 Piece Bathroom, inside garage entry and a walk out to the backyard haven with a 3 season gazebo. The Laundry room has a large window and shelves. Outside has a 'cottage retreat-like' feel with muli-level decking, a treed private yard, extensive gardens, 8 x 12 chalet style shed all set on .65 of an acre.</PublicRemarks>
<UtilitiesAvailable>
<Utility>
<Type>Natural Gas</Type>
<Description>Available</Description>
</Utility>
<Utility>
<Type>Water</Type>
<Description>Available</Description>
</Utility>
</UtilitiesAvailable>
<ViewType>View</ViewType>
<AnalyticsClick><![CDATA[<script type='text/javascript'>
function redirect() {
var event = new RlEvent('crealocation');
event.viewedProperty(13560156,2100,[1460791,1452910],[272203,272203],[1587467,1587467],[0,0]);
event.set('event', 'type', 'click');
event.record();
setTimeout("window.location = 'http://peggyhill.com/listings/1306586'",500);}
</script>]]></AnalyticsClick>
<AnalyticsView><![CDATA[<script src='http://analytics.crea.ca/crearl.js' type='text/javascript'></script>
<script type='text/javascript'>
var event = new RlEvent('crealocation');
event.viewedProperty(13560156,2100,[1460791,1452910],[272203,272203],[1587467,1587467],[0,0]);
event.set('event', 'type', 'view');
event.record();
</script>]]></AnalyticsView>
<MoreInformationLink>http://peggyhill.com/listings/1306586</MoreInformationLink>
</PropertyDetails>
</RETS-RESPONSE>
</RETS>