2010-07-17 165 views
0

我正在向網站發送GET請求,並想知道根據以下參數執行此操作的正確方法是什麼。GET網絡請求參數

主持人:www.somesite 的User-Agent:Mozilla的/ 5.0(窗口; U; Windows NT的5.1; EN-US; rv中:1.9.2.6)的Gecko/20100625 的Firefox/3.6.6 GTB7.1 (.NET CLR 3.5.30729; .NET4.0E) 接受:text/javascript,text/html,application/xml,text/xml,/ Accept-Language:zh-cn,en; q = 0.5 Accept-Encoding:gzip,deflate Accept-Charset:ISO-8859-1,utf-8; q = 0.7,*; q = 0.7 Keep-Alive:115 Connection:keep-alive X-Requested-With: XMLHttpRequest X-Prototype-Version:1.6.1 內容類型:application/x-www-form-urlencoded;字符集= UTF-8 的Referer:http://www.somewebsite.com/search/ 的Content-Length:19 餅乾:__some餅乾 雜注:無緩存 緩存控制:無緩存

我沒有使用Firebug得到這個和現在試圖創建自己的請求頭如下:

 webRequest = TryCast(System.Net.WebRequest.Create(url), HttpWebRequest) 

     Thread.Sleep(New TimeSpan(0, 0, 10)) 
     'webRequest.Credentials = credentials 
     webRequest.Headers.Add("Cookie", cookielogin) 

     webRequest.Method = method__1.ToString() 
     webRequest.ServicePoint.Expect100Continue = True 
     webRequest.ContentType = "application/x-www-form-urlencoded" 
     webRequest.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 GTB7.1 (.NET CLR 3.5.30729; .NET4.0E)" 
     webRequest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" 
     webRequest.KeepAlive = True 

我的網址,我有表演的螢火後頭部以下參數:

ajax 1 
page  2 
q   item 

現在我已經將它包含在我的獲取請求中,因爲我需要檢索多個頁面,但我只返回頁面1。我缺少的東西

回答

0

我能解決這個;感謝您的迴應。

它涉及將參數放在請求的主體內。

0

找螢火蟲,您可以查看請求頭和您的自定義請求頭從服務器設置爲/

+0

我使用螢火蟲請參閱上面的編輯 – vbNewbie 2010-07-17 15:27:18