I am using PHRETS method for pulling data from MLS server. But i am not getting images from server. Please see the full code which i am used and out put array also.
Please help me..
<?php
$rets_login_url = '*******';
$rets_username = '*******';
$rets_password = '******';
$rets_user_agent = 'PHRETS/1.0';
$rets_user_agent_password = '********';
// use
http://retsmd.com to help determine the SystemName of the DateTime field which
// designates when a record was last modified
$rets_modtimestamp_field = "ListDate";
// 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("1");
// DateTime which is used to determine how far back to retrieve records.
// using a really old date so we can get everything
$previous_start_time = date('Y-m-d\TH:i:s', time()-15778800);
$limit = 5;
//////////////////////////////
require_once("phrets.php");
// start rets connection
$rets = new phRETS;
$rets->AddHeader("User-Agent", $rets_user_agent);
$rets->SetParam("compression_enabled", true);
echo "+ Connecting to {$rets_login_url} as {$rets_username}<br>\n";
$connect = $rets->Connect($rets_login_url, $rets_username, $rets_password, $rets_user_agent_password);
// check for errors
if ($connect)
{
echo " + Connected<br>\n";
}
else
{
echo " + Not connected:<br>\n";
print_r($rets->Error());
exit;
}
foreach ($property_classes as $class)
{
$query = "({$rets_modtimestamp_field}={$previous_start_time}+)";
// run RETS search
echo " + Query: {$query} Limit: {$limit}<br>\n";
$search = $rets->SearchQuery("Property", $class, $query, array('StandardNames' => 1,'Limit' => $limit, 'Format' => 'COMPACT-DECODED', 'Count' => 1));
if ($rets->NumRows() > 0)
{
while ($record = $rets->FetchRow($search))
{
$photos = $rets->GetObject("Property","Photo",$record['ListingID'],"*",0);
echo "<pre>";
print_r($photos);
foreach ($photos as $photo) {
$listing = $photo['Content-ID'];
$number = $photo['Object-ID'];
if ($photo['Success'] == true) {
$contentType = $photo['Content-Type'];
$base64 = base64_encode($photo['Data']);
echo "<img src='data:{$contentType};base64,{$base64}' />";
}
else {
echo "({$listing}-{$number}): {$photo['ReplyCode']} = {$photo['ReplyText']}\n";
}
}
echo "<pre>";
print_r($record);
}
$maxrows = $rets->IsMaxrowsReached();
echo " + Total found: {$rets->TotalRecordsFound()}<br>\n";
}
}
// echo "+ Disconnecting<br>\n";
$rets->Disconnect();
?>
Output Array:
Array
(
[0] => Array
(
[Success] =>
[Content-Type] => text/xml
[MIME-Version] => 1.0
[Length] => 138
[Data] =>
[ReplyCode] => 20402
[ReplyText] => Unknown Resource A2166184 Reference ID: 66d39fb2-446f-4c51-ab65-65010b244d50
)
)
(-): 20402 = Unknown Resource A2166184 Reference ID: 66d39fb2-446f-4c51-ab65-65010b244d50
Array
(
[Type] => Single Family
[PostalCode] => 33063
[Bedrooms] => 3
[DaysOnMarket] => 28
[BathsFull] => 2
[BathsHalf] => 0
[LivingArea] => 1580
[ModificationTimestamp] => 2015-11-04T09:13:00
[ListOfficeOfficeID] => KELR03
[ListDate] => 2015-08-26T00:00:00
[ListAgentAgentID] => 0632982
[ListPrice] => 214900
[ListAgentFirstName] => R. Ginenne Boehm
[ListingID] => A2166184
[Remarks] => Charming waterfront home 3 bedrooms,2 baths, family room,1 car garage, pool, covered screened patio, huge fenced yard, updated kitchen and baths, Freshly painted in and out!
[ClosePrice] => 205000
[SaleOfficeOfficeID] => KELR03
[SaleAgentAgentID] => 0632982
[StatusChangeDate] => 2015-11-04T09:13:00
[ListingStatus] => Closed Sale
[StreetName] => 77TH AV
[StreetNumber] => 216
[MapCoordinate] =>
[TaxID] => 484135040310
[City] => Margate
[State] => Florida
[Directions] => ATLANTIC BLVD. WEST OF ROCK ISLAND ROAD, AFTER LIGHT (78TH AVE) TURN LEFT AT 77TH AVE.
[SaleAgentNRDSMemberID] =>
)
..........
..........