How to get nearest theater listing depending upon zipcode?
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();
精彩评论