The POI Search Feed provides a lists of POIs. This feed can drive functionality like Attraction, Hotel, Dining, Nightlife and Shop Lists.
POI Search
For more information, browse the POI Search API
Request:
Response:
<searchResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="feedschema/base.xsd" totalResultCount="335" currentPage="1" currentPageResultCount="5" totalPageCount="67" sort="rank" sortDirection="ascending">
<poiResult id="209428" name="Musée d'Orsay" type="ATTRACTION" typeName="Attraction" subType="MUSEUM" subTypeName="Museum" city="Paris" country="France" latitude="48.8602" longitude="2.3248" rankId="4"/>
<poiResult id="209429" name="Sainte-Chapelle" type="ATTRACTION" typeName="Attraction" subType="RELIGIOU_SITE" subTypeName="Religious Site" city="Paris" country="France" latitude="48.8553" longitude="2.3448" rankId="4"/>
<poiResult id="209430" name="Tour Eiffel" type="ATTRACTION" typeName="Attraction" subType="LANDMARK" subTypeName="Landmark" city="Paris" country="France" latitude="48.8580" longitude="2.2946" rankId="4"/>
<poiResult id="209431" name="Centre Pompidou" type="ATTRACTION" typeName="Attraction" subType="MUSEUM" subTypeName="Museum" city="Paris" country="France" latitude="48.8607" longitude="2.3524" rankId="4"/>
<poiResult id="209479" name="Cimetière du Père-Lachaise" type="ATTRACTION" typeName="Attraction" subType="CEMETERY" subTypeName="Cemetery" city="Paris" country="France" latitude="48.8607" longitude="2.3939" rankId="4"/>
</searchResponse> Call the feed URL, using curl
$ch = curl_init(); // Set up curl
curl_setopt($ch, CURLOPT_URL, $url); // Add url
curl_setopt($ch, CURLOPT_HEADER, 0); // Remove header
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return data
curl_setopt($ch, CURLOPT_TIMEOUT, 10); // Set timeout, 10s
$response = curl_exec($ch); // Call feed
curl_close($ch); // Close curl, free resources
Convert response to XML, use xpath to get list of Point of Interests
$xml = new SimpleXMLElement($response); // Create xml object
$pioResults = $xml->xpath("//poiResult"); //Use xpath to get list of Point of Interests
Build output dynamically by iterating POI links and details
<div class="poiSearch">
<ul class="detailList">
<?php foreach ($pioResults as $result) { ?>
<li>
<a href="#"><?php echo $result["name"]; ?></a><?php if($result["extendedInfo"]) { ?> (<?php echo $result["extendedInfo"]; ?>) <?php } ?>
<div><?php echo $result["neighborhood"]; ?></div>
<?php if ($result["rankId"] && $result["rankId"] != "") { ?>
<div style="float:left" class="rank<?php echo $result["rankId"];?>"><?php echo $result["rankId"];?></div>
<?php } ?>
<?php if ($result["priceCategory"] && $result["priceCategory"] > 0) { ?>
<div class="price<?php echo $result["priceCategory"];?>"><?php echo $result["priceCategory"];?></div>
<?php } ?>
<div style="clear:both"></div>
</li>
<?php } ?>
</ul>
</div>
Loading...
