#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2004
    Posts
    354
    Rep Power
    46

    Need help with phRETS


    I'm trying out phRets for the first time for a real estate site I have to build, and can't seem to get past the starting gate.

    I can connect to the RETS server just fine, but can't execute a query. The code below is pasted verbatim (with one exception) from the first example at https://github.com/troydavisson/PHRETS/wiki/SearchQuery, which I think is authored by the guy who invented phRets.

    The line that tries to assign the value of $search is where it's failing. It isn't throwing an error, it's just returning false.

    The exception in my copy/paste is the "1" in that line instead of the example's "RES." The residential property class on the server I'm using is 1, not RES. I also tried the "1" as both a number and a string.

    Any ideas? TIA.

    Code:
    $rets_login_url = "";
    $rets_username = "";
    $rets_password = "";
    
    require_once("phrets.php");
    
    $rets = new phRETS;
    
    $connect = $rets->Connect($rets_login_url, $rets_username, $rets_password);
    
    $search = $rets->SearchQuery("Property", 1, "(ListDate=1990-01-01+)");
    
    while ($listing = $rets->FetchRow($search)) {
    
    	echo "Address: {$listing['StreetNumber']} {$listing['StreetName']}, ";
    	echo "{$listing['City']}, ";
    	echo "{$listing['State']} {$listing['ZipCode']} listed for ";
    	echo "\$".number_format($listing['ListPrice'])."<br>";
    
    }
    
    $rets->FreeResult($search);
    
    $rets->Disconnect();
    
    exit;
  2. #2
  3. Nosey Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,607
    Rep Power
    9417
    Are you sure it's 1? Apparently there's some GetMetadataClasses thing that can tell you what they all are.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2004
    Posts
    354
    Rep Power
    46
    Originally Posted by requinix
    Are you sure it's 1? Apparently there's some GetMetadataClasses thing that can tell you what they all are.
    Yeah, it's GetMetadataTypes(), and that's how I verified that this server's Property classes were the numeric values.
  6. #4
  7. Nosey Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,607
    Rep Power
    9417
    No, I meant GetMetadataClasses. From the documentation:
    $class - RETS Class. See GetMetadataClasses to learn the available classes of a RETS server.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2004
    Posts
    354
    Rep Power
    46
    Originally Posted by requinix
    No, I meant GetMetadataClasses. From the documentation:
    MetadataClasses is one level too high -- it's data types such as Property, Agents, Users. I used metadatatypes to find out the permissible values under Property.
  10. #6
  11. No Profile Picture
    buildmyweb.org
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Location
    NY
    Posts
    83
    Rep Power
    8
    im having the exact same issue with PHRETS. can connect and pull metadata. but my queries arent succeeding. was there any resolution on this topic fbraun?
    Freelance Web Developer | PHP Applications
    Web Development, Hosting, Graphic Design, SEO
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2004
    Posts
    354
    Rep Power
    46
    Originally Posted by BuildMyWeb
    im having the exact same issue with PHRETS. can connect and pull metadata. but my queries arent succeeding. was there any resolution on this topic fbraun?
    This was so long ago I don't remember how I resolved it, but I did. I've attached a zip file containing my code in case that may help. Look at index.php first to understand what all the rest is.

    I ended up being pretty disappointed with phRETS, though, because I ran into all kinds of timeout and other issues if you're pulling more than just a small dataset.

    Good luck anyway!
    Attached Files
  14. #8
  15. No Profile Picture
    buildmyweb.org
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Location
    NY
    Posts
    83
    Rep Power
    8
    thanks for the file and the opinion on phrets. what would you recommend for a RETS connector?
    Freelance Web Developer | PHP Applications
    Web Development, Hosting, Graphic Design, SEO
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2004
    Posts
    354
    Rep Power
    46
    Originally Posted by BuildMyWeb
    thanks for the file and the opinion on phrets. what would you recommend for a RETS connector?
    Have a look at retsconnector.com. I don't like it in principle because it uses a PC in the realtors office to pull the RETS data from one server, then you have to do another step to move it to the realtor's website. I use ws_ftp's scripting capability for that.

    This all works very dependably. With retsconnector, you can look at the metadata and select which fields you want included in your downloads, and schedule those downloads.. Also some choices in handling property photos if I'm remembering right.

    Here's a very good step-by-step for how to use it:

    RETS Connector

    Best of luck.

IMN logo majestic logo threadwatch logo seochat tools logo