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

    Join Date
    Oct 2004
    Posts
    349
    Rep Power
    45

    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. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,754
    Rep Power
    9397
    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
    349
    Rep Power
    45
    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. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,754
    Rep Power
    9397
    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
    349
    Rep Power
    45
    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.

IMN logo majestic logo threadwatch logo seochat tools logo