【发布时间】:2019-03-15 14:20:49
【问题描述】:
我有一个想要阅读的 XML 文件,但似乎无法理解。
要访问我提取的文件,您可以输入:
我是通过 PHP 做的,所以我的代码如下:
<html>
<head>
<title>Hellow World</title>
</head>
<body>
<?php
$zillow_id = 'X1-ZWz1gyo1562s5n_6sext';
$search = '155 Demar Blvd';
$citystate = 'Canonsburg PA';
$address = urlencode($search);
$citystatezip = urlencode($citystate);
$url = "http://www.zillow.com/webservice/GetSearchResults.htm?zws-id=$zillow_id&address=$address&citystatezip=$citystatezip";
$result = file_get_contents($url);
$data = simplexml_load_string($result);
echo $data->response->results->result->lotSizeSqFt . "<br>";
?>
</body>
</html>
我曾预计此代码会在屏幕上打印出批次大小(以平方英尺为单位)。没有骰子。
但是,代码行:
echo $data->response->results->result->zpid . "<br>";
返回 zpid 参数的预期值:49785503。
理想世界中的代码行:
echo $data->response->results->result->lotSizeSqFt . "<br>";
将返回:9000。
我做错了什么?
【问题讨论】:
-
lotSizeSqFt不在结果集中 -
对我来说似乎是,但不确定您所说的“结果集”是什么意思。
49785503 ... ...42125 SingleFamily 2018 170100.0 1948 9000