protected voidButton1_Click (Objectsender, EventArgs e) { stringPhone = This. Txt_con.text; stringURL ="http://api.showji.com/Locating/www.show.ji.c.o.m.aspx?m="+Phone; foreach(stringIteminchgethttpxml (URL)) {TextBox1.Text+ = Item +"\ n"; } } Public string[] Gethttpxml (stringURL) {XmlDocument XML=NewXmlDocument (); Xml. Load (URL); XmlNamespaceManager xmlnm=NewXmlNamespaceManager (XML. NameTable); Xmlnm.addnamespace ("content","http://api.showji.com/Locating/"); XmlNodeList nodes= XML. SelectNodes ("//content:queryresult|//content:mobile|//content:province|//content:city|//content:corp|//content:card|// Content:areacode|//content:postcode", XMLNM); if(Nodes. Count = =8) { if("True". Equals (nodes[1]. InnerText)) {return New string[] {"Phone Number:"+nodes[0]. InnerText,"Operating provider:"+nodes[2]. InnerText,"Province of Attribution:"+nodes[3]. InnerText,"Attribution City:"+nodes[4]. InnerText,"City Area code:"+nodes[5]. InnerText,"City Zip code"+nodes[6]. InnerText}; } } return New string[] {"FALSE" }; }
Code
Capture packet parsing XML file as JSON