Question

Assume that the below array I got from the NWMLS real estate services,

array(
 ...
 ...
 ...
 STA - A
 BRM - U
 DNO - M
 DRM - M
 ENT - M
 F17 - A
 FAM - M
 ...
 ...
 ...
)

If you see the STA which is a short code that represents 'STATUS' and A represents 'ACTIVE'.

1. How to get the full description or Amenity data/ results for 'A' as 'Active' and also for other values from NWMLS real estate services using XML query with PHP?

Note: The C# programmers are using XMLNodelist predefined class or function to get all of these long or full description for all of the array values.

<?php    
try {
    $client=new SoapClient('http://evernet.nwmls.com/evernetqueryservice/evernetquery.asmx?WSDL');
    $XMLQuery ="<?xml version='1.0' encoding='utf-8' standalone='no' ?>";
    $XMLQuery .="<EverNetQuerySpecification xmlns='urn:www.nwmls.com/Schemas/General/EverNetQueryXML.xsd'>";
    $XMLQuery .="<Message>";
    $XMLQuery .="<Head>";
    $XMLQuery .="<UserId>username</UserId>";
    $XMLQuery .="<Password>password</Password>";
    $XMLQuery .="<SchemaName>StandardXML1_1</SchemaName>";
    $XMLQuery .="</Head>";
    $XMLQuery .="<Body>";
    $XMLQuery .="<Query>";
    $XMLQuery .="<MLS>NWMLS</MLS>";
    $XMLQuery .="<PropertyType>propertytype</PropertyType>";
    $XMLQuery .="<Status>A</Status>";
    $XMLQuery .="<BeginDate>2013-05-07T23:00:00</BeginDate>";;
    $XMLQuery .="<EndDate>2013-11-07T00:00:00</EndDate>";
    $XMLQuery .="</Query>";
    $XMLQuery .="<Filter></Filter>";
    $XMLQuery .="</Body>";
    $XMLQuery .="</Message>";
    $XMLQuery .="</EverNetQuerySpecification>";
    $params = array ('v_strXmlQuery' => $XMLQuery);
    $result = $client->RetrieveListingData($params);     
    $access = $result->RetrieveListingDataResult;    
    $xml_result = new SimpleXMLElement($access);
    print_r($xml_result);
} catch(DynamoDbException $e) {
    echo 'The item could not be retrieved.';
}
?>

Sorry! Since there is no tag for NWMLS I chose RETS.

Was it helpful?

Solution

$nodelist = $client->RetrieveAmenityData($params); 
$accessnodelist = $nodelist->RetrieveAmenityDataResult;
$xml_amenity_result = new SimpleXMLElement($accessnodelist);
echo '<pre>';
print_r($xml_amenity_result);
echo '</pre>';

The above code can fetch the full or long description for both array keys and values.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top