2
분 속성을 각각 routeTit 아래에 에코하려고합니다.XML 속성 파싱 PHP
내 출력 : http://zxstudios.ca/api/test2.php
XML : http://webservices.nextbus.com/service/publicXMLFeed?command=predictions&a=ttc&stopId=1974 그래서 예를 들면
<?php
$stopid="1974";
$urlbase = "http://webservices.nextbus.com/service/publicXMLFeed?command=predictions&a=ttc&stopId=";
$url = $urlbase.$stopid;
$xml = simplexml_load_file($url);
$rt = $xml->predictions;
foreach ($rt as $value) {
echo $value->attributes()->routeTitle."Min. <br>";
}
echo $rt->direction->attributes()->minutes;
?>
:
325-Don Mills
3 Min.
1 Min.
185-Don Mills Rocket
2 Min.
1 Min.
25-Don Mills
2 Min.
1 Min.
업데이트 질문 : 올바른 노드에 액세스하고 "경고를 피하기 어떻게 : main() : 노드가 더 이상 존재하지 않습니다 ... "? 각 routeTitle에 대한 분 속성 값을 에코하려면
그래서 귀하의 질문에 무엇입니까? –
죄송합니다 * 내 질문은 올바른 노드에 액세스하고 "경고 : main() : 노드가 더 이상 존재하지 않습니다 ..." – Zedkay22