1

我想使用 Yahoo Placefinder API 进行城市输入的用户注册(自动建议)。根据文档,我可以向以下 GET 请求:

http://where.yahooapis.com/geocode?city=falenty&country=poland&appid=yourappid

如果你把它放在浏览器中,它会给你一些 XML:

...
<line1/>
<line2>05-090 Falenty</line2>
<line3/>
<line4>Poland</line4>
<house/>
<street/>
<xstreet/>
<unittype/>
<unit/>
<postal>05-090</postal>
<neighborhood>Falenty</neighborhood>
<city>Raszyn</city>
<county>Pruszkow County</county>
...

但如果我按城市搜索,我不想按社区搜索。如果没有这个名字的城市,我不想得到任何结果。

是否有人知道这是否可能,或者我是否需要遍历结果并排除城市与 URI 中发送的城市不同的结果?这不是一个优雅的解决方案,因为有时它会给我超过 10 个结果,而我正在搜索的城市甚至没有 1 个结果。

4

0 回答 0