Media download problem with Toronto Real estate board using new version of PHRETS 2.0

1,106 views
Skip to first unread message

Ratnam Sasitharan

unread,
Jul 3, 2015, 4:30:27 PM7/3/15
to phr...@googlegroups.com
Hi All

I am having problem to download media from TREB. For the test purpose i am using the following code. When i try use var_dump($photos) i got the following message

string '<?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."/>
' (length=192)

=====================================================
The following is my code
==================================================

<?php

date_default_timezone_set("Canada/Eastern");

require_once("vendor/autoload.php");

$log = new \Monolog\Logger('PHRETS');
$log->pushHandler(new \Monolog\Handler\StreamHandler('php://stdout', \Monolog\Logger::DEBUG));

$config = new \PHRETS\Configuration;
        ->setUsername('userid')
        ->setPassword('password')
        ->setRetsVersion('1.7');

$rets = new \PHRETS\Session($config);
$rets->setLogger($log);

$connect = $rets->Login();
$timestamp_field = 'Timestamp_sql';
$st="Status";
$property_classes = ['ResidentialProperty', 'CondoProperty', 'Commercial'];
if($connect)
{
$sysid = "E3215462";//ml_num is a key_field
$n = 1;
$dir = 'photos/'.$sysid;
if(!is_dir($dir)) mkdir($dir); // Remember: this can only make one directory at a time
$photos = $rets->GetObject('Property','Photo',$sysid);
//var_dump($photos);
foreach($photos as $photo) {
//var_dump($photo->getContent());
file_put_contents($dir.'/'.$n.'.jpg',$photo->getContent());
$n++;
}
$rets->Disconnect();
echo "done";
}
else
{
$error = $rets->Error();
print_r($error);
}

Please help me

Ratnam Sasitharan

Tom Ashworth

unread,
Jul 4, 2015, 11:16:46 AM7/4/15
to phr...@googlegroups.com
What that is telling you is that it finds no Photo with that ID? 

// grab the first object of the set
$objects->first();

I would try the above and use RETSMD to see what it is expecting.

Hope this helps a little.

Tom

Ratnam Sasitharan

unread,
Jul 4, 2015, 7:07:18 PM7/4/15
to phr...@googlegroups.com
Thank you for your reply. I tried first object then use var_dump. the same error message. this mls number has 6 photos in the TMLS system. so i got 6 error messages (no object found for each object). i checked RETSMD.

Thank you

Ratnam Sasitharan

unread,
Jul 7, 2015, 12:08:15 AM7/7/15
to phr...@googlegroups.com
Please help me to solve the problem

Tom Ashworth

unread,
Jul 7, 2015, 11:17:07 AM7/7/15
to phr...@googlegroups.com
Did you step through this in debug in your php editor.  I use nusphere, and set a breakpoint, then I look at the values in each varibal.  That would tell us enough to help you.  Without having your login information, I cannot determinen the value of $photos.

Tom

Slava Yakobson

unread,
Apr 3, 2017, 12:48:33 PM4/3/17
to PHRETS
Hi Ratnam,

Were you able to figure it out?

I am writing a script to download all the listings from VOW, it would really help if I could see your solution.

Thanks!

Maninder Singh

unread,
Sep 12, 2017, 12:40:38 PM9/12/17
to PHRETS






Hi ,

           I am using software like RetsConnector . Its use for download real estate data from this software.But when i try to download data from this            software its always failed.
                                    Its always says that like

                                         "could not find 'c':\window\system32 rets.20041001.dtd".

But if i try this download on my local desktop then its working fine.I don't know why on this server  show this type error.
Please suggest us if any kind of server setting is required in this server.

shuayb Qureshi

unread,
Jul 6, 2018, 8:56:55 PM7/6/18
to PHRETS

Hey Maninder! 
Were you able to successfully retrieve data from the TREB sever. 
I am trying to connect but it keeps on throwing this error on me "Fatal error: Uncaught PHRETS\Exceptions\RETSException: Invalid DMQL query (0) in C:\wamp64\www\PHRETS-master\src\Session.php on line 424" 
Is possible for you to send me of your sample queries? 
Thanks 
Shuayb 
Reply all
Reply to author
Forward
0 new messages