Today, through the search of data to understand the Web page crawl function, the application of HttpWebRequest and HttpWebResponse functions, from the http://www.showji.com site to capture the attribution of information
It should be said that this method is learned from other forums, the process is as follows:
Through the IE9 network monitoring function:
By analyzing the captured data, you will get the information of the place of attribution.
Analyze a piece of data we can get the following information
Returned is a JSON data, we pass the http://api.showji.com/locating/www.show.ji.c.o.m.aspx?m=18311095178&output=json& callback=querycallback×tamp=1411465926173 This web site can also get the relative JSON data;
When we intercept this URL from the back of the phone and use the first half of it, the page data becomes the following: XML file
The rest of the steps are simple, as long as the XML file obtained by the analysis, we can get the data we want
Web page specific code is as follows
1 protected voidButton1_Click (Objectsender, EventArgs e)2 {3 stringPhone = This. Txt_con.text;4 stringURL ="http://api.showji.com/Locating/www.show.ji.c.o.m.aspx?m="+Phone;5 6 foreach(stringIteminchgethttpxml (URL))7 {8 9TextBox1.Text + = Item +"\ n";Ten } One } A - Public string[] Gethttpxml (stringURL) - { theXmlDocument 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) A { at 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}; - } - } in return New string[] {"FALSE" }; -}
Operating effect:
C # to get the phone attribution function