網(wǎng)站數(shù)據(jù)抓取-創(chuàng)新互聯(lián)

創(chuàng)新互聯(lián)網(wǎng)站建設(shè)提供從項(xiàng)目策劃、軟件開(kāi)發(fā),軟件安全維護(hù)、網(wǎng)站優(yōu)化(SEO)、網(wǎng)站分析、效果評(píng)估等整套的建站服務(wù),主營(yíng)業(yè)務(wù)為成都做網(wǎng)站、網(wǎng)站制作,成都App定制開(kāi)發(fā)以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠(chéng)的服務(wù)。創(chuàng)新互聯(lián)深信只要達(dá)到每一位用戶的要求,就會(huì)得到認(rèn)可,從而選擇與我們長(zhǎng)期合作。這樣,我們也可以走得更遠(yuǎn)!>1:
private bool ImportSubjectQuesData(int bankId, int categoryId, int curpage, int pagesize) { string postData = "bankid=" + System.Web.HttpUtility.UrlEncode(bankId.ToString(), System.Text.Encoding.ASCII); postData+= "&categoryid=" + System.Web.HttpUtility.UrlEncode(categoryId.ToString(), System.Text.Encoding.ASCII); postData+= "&curpage=" + System.Web.HttpUtility.UrlEncode(curpage.ToString(), System.Text.Encoding.ASCII); ....參數(shù)省.... string url = "http://www.*****.com/Web/Handler1.ashx?action=queslistquery"; byte[] byteArray = Encoding.UTF8.GetBytes(postData); var webRequest = (HttpWebRequest)WebRequest.Create(new Uri(url)); webRequest.Method= "post"; webRequest.ContentType= "application/x-www-form-urlencoded"; webRequest.ContentLength= byteArray.Length; Stream newStream= webRequest.GetRequestStream(); newStream.Write(byteArray,0, byteArray.Length); newStream.Close(); //接收HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse(); StreamReader php= new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("utf-8")); string result = php.ReadToEnd(); int Index = result.IndexOf("###"); var retCount = DeserializeObject(result.Substring(0, Index)); int Count = Convert.ToInt32(retCount.quescount.Value); int intPagesize = Convert.ToInt32(pagesize);數(shù)int pageCount = Count % intPagesize == 0 ? Count / intPagesize : Count / intPagesize + 1; result= result.Substring(Index + "###".Length); var questlt = DeserializeObject(result); //數(shù)據(jù)錄入return InserData(questlt); }

2:
string url = txtshiUrl.Text + i;
var webRequest = (HttpWebRequest)WebRequest.Create(new Uri(url));
webRequest.Method = "GET";
webRequest.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)";
webRequest.ContentType = "text/html; charset=gbk";
webRequest.KeepAlive = true;
webRequest.Referer = url;
webRequest.CookieContainer = new CookieContainer();
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
responseStream = webResponse.GetResponseStream();
StreamReader streamReader = new StreamReader(responseStream, Encoding.GetEncoding("gbk"));
string shtml = streamReader.ReadToEnd();網(wǎng)站數(shù)據(jù)抓取

文章名稱:網(wǎng)站數(shù)據(jù)抓取-創(chuàng)新互聯(lián)
文章來(lái)源:http://muchs.cn/article48/dpsiep.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊(cè)、做網(wǎng)站、響應(yīng)式網(wǎng)站、網(wǎng)站制作、全網(wǎng)營(yíng)銷推廣標(biāo)簽優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)