开发者

How to get nearest theater listing depending upon zipcode?

开发者 https://www.devze.com 2023-03-05 07:56 出处:网络
I need to find list of near by theaters depending upon user zipcode input, I have an api which gives this information if we pass zipcode but am not sure as to how to use this api, this is my first tim

I need to find list of near by theaters depending upon user zipcode input, I have an api which gives this information if we pass zipcode but am not sure as to how to use this api, this is my first time trying to get data from api and am not familiar with atom, pox and ast acronyms.

A开发者_JAVA技巧PI that gives theater information is located at http://gateway.moviefone.com/, any guidance suggestion would be highly appreciate to get started with using this api and understanding about how to work with api's.


There's several steps involved, here's some pseudocode to help you get started:

String zip = "...";
String url = "http://gateway.moviefone.com/movies/pox/closesttheaters.xml?zip=" + zip;

// read and parse the xml
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(url);

//get elements you need
NodeList list = document.getElementsByTagName("closestTheatersUrl");
String urlForTheater = list.item(0).getNodeValue();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号