문제

I am trying to fetch all MLS agents using phrets, but everything I try returns nothing.

The goal of this is to be able to get more info about a salesperson of an MLS listing.

# Search query
$search = $rets->SearchQuery("roster","Agent","*");

If that is not possible, is there any way how I can figure out all available fields for that class?

도움이 되었습니까?

해결책

You can enter in your RETS login information into RETS M.D. and it will return all metadata and fields for each class (ResidentialProperty, Agent, etc).

If you want to get the listing agent's information for a specific MLS listing and you have the MLS ID, it would be something like this:

    $mlsNumber = 130050044;

    //Perform search query for a specific MLS Id
    $search = $rets->SearchQuery("Property", "9", "(MLNumber_f139={$mlsNumber})", array('Limit' => 1, 'Format' => 'COMPACT'));

    $numRows = $rets->NumRows();

    if ($numRows > 0) {

        $listing = $rets->FetchRow($search);
        // Get Agent's public Id from MLS listing
        $agentId = $listing['ListingPublicID_f1187'];

        // Perform search query for Agent using Agent Id
        $search = $rets->SearchQuery("User", "14", "(AgentPublicID_f1191={$agentId})", array('Limit' => 1, 'Format' => 'COMPACT'));
        $numRows = $rets->NumRows();

        if ($numRows > 0) {
            $listing = $rets->FetchRow($search);
            $agentName = $listing['AgentFullName_f1595'];
            echo "Agent Name : " . $agentName . "<br />";
            // echo more Agent Details here
        }

    }

    $rets->FreeResult($search);

If you wanted to run a search query to return all Agents from a RETS Server, your DMQL might search for all agents with a status of Active.

다른 팁

To figure out all available fields of a class, use

$fields = $rets->SearchGetFields($search);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top