Read xml data from url using curl and php

后端 未结 3 1622
滥情空心
滥情空心 2020-12-30 17:26

I want to read XML data from a URL. I have the URL as follows:

http://www.arrowcast.net/fids/mco/fids.asp?sort=city&city=&number=&airline=&adi=A

<
3条回答
  •  醉酒成梦
    2020-12-30 17:46

    // the SAX way:
    XMLReader myReader = XMLReaderFactory.createXMLReader();
    myReader.setContentHandler(handler);
    myReader.parse(new InputSource(new URL(url).openStream()));
    
    // or if you prefer DOM:
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.parse(new URL(url).openStream());
    

提交回复
热议问题