xml
ページを呼び出すと、この結果が得られますgetRout.php
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Document>
<name>KML Samples</name>
<open>1</open>
<distance>20.831418618295</distance>
<description>To enable simple instructions add: 'instructions=1' as parameter to the URL</description>
<Folder>
.
.
.
.
</kml>
私はこのjqueryスクリプトを使用してxml応答を取得します:
$(document).ready(function(){
$.ajax({
type: "GET",
url: "getRout.php",
dataType: "xml",
success: function(xml) {
$(xml).find('coordinates').each(function(){
var t = $(this).text();
alert(t);
});
}
});
});
編集
これはgetRout.php
ファイルの内容です..
<?
require_once "RESTclient.class.php";
$url = "http://www.yournavigation.org/api/1.0/gosmore.php?format=kml&flat=52.215676&flon=5.963946&tlat=52.2573&tlon=6.1799&v=motorcar&fast=1&layer=mapnik";
header("Content-type:text/xml");
$result = RestClient::get($url,$inputs);
echo($result->getResponse());
?>