yahoo weather로 API 호출을 할 때 다음 xml이 반환되었습니다. $ out을 에코 할 때 왜 공백이됩니까?
$endpoint = 'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%3D%20560743&diagnostics=true';
$xml = simplexml_load_file($endpoint) or die('failed to load xml');
$out = $xml -> query -> diagnostics -> publiclyCallable;
echo $out;
반환 된 XML :
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="1" yahoo:created="2017-02-10T11:54:56Z" yahoo:lang="en-US">
<diagnostics>
<publiclyCallable>true</publiclyCallable>
<url execution-start-time="1" execution-stop-time="7" execution-time="6">...</url>
<user-time>8</user-time>
<service-time>6</service-time>
<build-version>2.0.92</build-version>
</diagnostics>
<results>...</results>
</query>
이미 나타내는 query
것처럼 제거하십시오 $xml
.
$endpoint = 'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%3D%20560743&diagnostics=true';
$xml = simplexml_load_file($endpoint) or die('failed to load xml');
$out = $xml -> diagnostics -> publiclyCallable;
echo $out; // `true`
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다