濮阳杆衣贸易有限公司

主頁 > 知識庫 > Asp WinHttp.WinHttpRequest.5.1 對象使用詳解 偽造 HTTP 頭信息

Asp WinHttp.WinHttpRequest.5.1 對象使用詳解 偽造 HTTP 頭信息

熱門標(biāo)簽:java外呼系統(tǒng)是什么 創(chuàng)意電話機器人 石家莊慧營銷外呼系統(tǒng) 地圖標(biāo)注陽江 世界地圖標(biāo)注了哪些城市 外呼線路批發(fā) 梧州市地圖標(biāo)注 武穴地圖標(biāo)注 濟源電銷外呼系統(tǒng)線路
由于微軟封鎖了 XmlHttp 對象,所以無法偽造部分 HTTP 頭信息,但是 WinHttp.WinHttpRequest.5.1 對象,它居然用可以成功偽造所有 http 請求的 header 信息!

從msdn得知,WinHttp.WinHttpRequest.5.1 是 msxml 4.0 的底層對象,也就是說 XMLHTTP/ServerXMLHTTP 也是在它的基礎(chǔ)上封裝而來,WinHttpRequest 的用法與 XmlHttp 大致相同。

WaitForResponse 在使用異步方式發(fā)送請求時,可以用這個方法來控制請求的進程,指定的等待時間,以秒為一個異步傳送方法來完成的值,SetTimeouts。

在服務(wù)端腳本中,不可以像客戶端那樣直接使用回調(diào)函數(shù)來控制異步請求,也沒有相應(yīng)的函數(shù)來使用程序休眠一定的時間,因此,為了等待請求返回,我們可以使用這個方法來等待一定時間。
復(fù)制代碼 代碼如下:

%
Dim WinHttp
Set WinHttp = Server.CreateObject("WinHttp.WinHttpRequest.5.1")
'設(shè)置參數(shù)
WinHttp.SetTimeouts 60000, 60000, 60000, 3000 '設(shè)置操作超時時間
'WinHttp.SetTimeouts resolveTimeout, connectTimeout, sendTimeout, receiveTimeout
'resolveTimeout = 10000 '解析 DNS 名字的超時時間,10000 毫秒。
'connectTimeout = 10000 '建立 Winsock 連接的超時時間,10000 毫秒。
'sendTimeout = 120000 '發(fā)送數(shù)據(jù)的超時時間,120000 毫秒。
'receiveTimeout = 60000 '接收 response 的超時時間,60000 毫秒。
WinHttp.Option(4) = 13056 '忽略錯誤標(biāo)志
WinHttp.Option(6) = False '為 True 時,當(dāng)請求頁面重定向跳轉(zhuǎn)時自動跳轉(zhuǎn),F(xiàn)alse 不自動跳轉(zhuǎn),截取服務(wù)端返回的302狀態(tài)。
WinHttp.Open "GET", "http://www.baidu.com/", False 'GET 或 POST, Url, False 同步方式;True 異步方式
'組成 HTTP 頭信息
WinHttp.SetRequestHeader "Accept", "*/*" '接受數(shù)據(jù)類型
WinHttp.SetRequestHeader "Accept-Language", "zh-cn,zh" '用戶系統(tǒng)語言
WinHttp.SetRequestHeader "User-Agent", "Mozilla/6.0" '用戶瀏覽器信息
WinHttp.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded" '編碼方式
WinHttp.SetRequestHeader "Referer", "http://www.baidu.com/" '來路
WinHttp.SetRequestHeader "Connection", "Close" 'Close = 不保持連接,Keep-Alive = 保持連接(持久連接)
'WinHttp.SetRequestHeader "Accept-Encoding", "gzip, deflate" '如果發(fā)送,會返回 gzip, deflate 壓縮過的編碼
'WinHttp.SetRequestHeader "Content-Length", Len(Str) '內(nèi)容長度,Post 方式用的。
WinHttp.SetRequestHeader "Cookie", "test cookie!" '設(shè)置 Cookie
'發(fā)送數(shù)據(jù)
WinHttp.Send 'Post 方式:WinHttp.Send (參數(shù))
WinHttp.WaitForResponse '等待返回請求,XMLHTTP中也可以使用
'輸出結(jié)果
Response.Write WinHttp.Status '當(dāng)前 HTTP 狀態(tài)
'Response.Write WinHttp.ResponseText '文本數(shù)據(jù)
Response.BinaryWrite WinHttp.ResponseBody '二進制數(shù)據(jù)流數(shù)據(jù)
%>

Option()相關(guān):

WinHttpRequestOption_UserAgentString = 0;
WinHttpRequestOption_URL = 1;
WinHttpRequestOption_URLCodePage = 2;
WinHttpRequestOption_EscapePercentInURL = 3;
WinHttpRequestOption_SslErrorIgnoreFlags = 4;
WinHttpRequestOption_SelectCertificate = 5; '13056 = 忽略錯誤標(biāo)志
WinHttpRequestOption_EnableRedirects = 6; '為True時,當(dāng)請求的頁面中有跳轉(zhuǎn)時,抓取跳轉(zhuǎn)頁面信息.False相反不抓取
WinHttpRequestOption_UrlEscapeDisable = 7;
WinHttpRequestOption_UrlEscapeDisableQuery = 8;
WinHttpRequestOption_SecureProtocols = 9;
WinHttpRequestOption_EnableTracing = 10;
WinHttpRequestOption_RevertImpersonationOverSsl = 11;
WinHttpRequestOption_EnableHttpsToHttpRedirects = 12;
WinHttpRequestOption_EnablePassportAuthentication = 13;
WinHttpRequestOption_MaxAutomaticRedirects = 14;
WinHttpRequestOption_MaxResponseHeaderSize = 15;
WinHttpRequestOption_MaxResponseDrainSize = 16;
WinHttpRequestOption_EnableHttp1_1 = 17;
WinHttpRequestOption_EnableCertificateRevocationCheck = 18;

方法 Description 說明

Abort 中止一個WinHTTP的 發(fā)送方法。
GetAllResponseHeaders 檢索所有的HTTP響應(yīng)頭。
GetResponseHeader 檢索HTTP響應(yīng)頭。
Open 打開一個HTTP連接到HTTP資源。
Send 發(fā)送一個HTTP請求到HTTP服務(wù)器。
SetAutoLogonPolicy 設(shè)置當(dāng)前自動登錄策略。
SetClientCertificate 選擇一個客戶端證書發(fā)送到一個安全的超文本傳輸協(xié)議(HTTPS)服務(wù)器。
SetCredentials 設(shè)置要使用的憑據(jù)與HTTP服務(wù)器,要么是原籍國或代理服務(wù)器。
SetProxy 設(shè)置代理服務(wù)器信息。
SetRequestHeader 添加,更改或刪除一個HTTP請求標(biāo)頭。
SetTimeouts 指定以毫秒為單位,個人的時間超過了一個組件發(fā)送/接收操作。
WaitForResponse 指定的等待時間,以秒為一個異步傳送方法來完成的值,SetTimeouts。

該 WinHttpRequest 對象定義以下屬性。

屬性 訪問類型 說明

Option 讀/寫 設(shè)置或檢索一個WinHTTP的選項值。
ResponseBody 只讀 檢索作為無符號字節(jié)數(shù)組的響應(yīng)實體機構(gòu)。
ResponseStream 只讀 檢索機構(gòu)作為響應(yīng)實體的IStream。
ResponseText 只讀 作為文本檢索響應(yīng)實體機構(gòu)。
Status 只讀 從上次檢索響應(yīng)的HTTP狀態(tài)代碼。
StatusText 只讀 獲取HTTP狀態(tài)的文本。

Events 活動

The WinHttpRequest object defines the following events.
WinHttpRequest 對象定義的下列事件。

Event 事件 Description說明

OnError Occurs when there is a run-time error in the application.
當(dāng)發(fā)生一個應(yīng)用程序運行時錯誤時發(fā)生。
OnResponseDataAvailable Occurs when data is available from the response.
當(dāng)響應(yīng)數(shù)據(jù)可用時發(fā)生。
OnResponseFinished Occurs when the response data is complete.
響應(yīng)數(shù)據(jù)完成時發(fā)生。
OnResponseStart Occurs when the response data starts to be received.
開始收到響應(yīng)數(shù)據(jù)時發(fā)生。

Remarks 備注

The WinHttpRequest object uses the IErrorInfo interface to provide error data.
該 WinHttpRequest 對象使用 IErrorInfo 接口來提供錯誤數(shù)據(jù)。
A description and numerical error value can be obtained with the Err object in Microsoft Visual Basic Scripting Edition (VBScript),
and the Error object in Microsoft JScript.
The lower 16 bits of an error number correspond to the values found in Error Messages.
Note For Windows XP and Windows 2000, see Run-Time Requirements.
注意:對于 Windows XP 和 Windows 2000,請參閱運行時間要求。

Requirements 要求

最低支持的客戶端 Windows XP, Windows 2000 Professional with SP3 Windows XP
最低支持的服務(wù)器 Windows Server 2003, Windows 2000 Server with SP3

可再發(fā)行 WinHTTP 5.0 and Internet Explorer 5.01 or later on Windows XP and Windows 2000.
WinHTTP的5.0和Internet Explorer 5.01或更高版本的Windows XP和Windows 2000。
IDL HttpRequest.idl HttpRequest.idl
Library Winhttp.lib Winhttp.lib
DLL Winhttp.dll Winhttp.dll
您可能感興趣的文章:
  • 用asp+xmlhttp編寫web采集程序
  • asp.net HttpWebRequest自動識別網(wǎng)頁編碼
  • Asp.net XMLHTTP封裝類(GET,Post發(fā)送和接收數(shù)據(jù))
  • 運行asp.net時出現(xiàn) http錯誤404-文件或目錄未找到
  • Javascript+XMLHttpRequest+asp.net無刷新讀取數(shù)據(jù)庫數(shù)據(jù)
  • asp.net利用HttpModule實現(xiàn)防sql注入
  • asp.net 模擬提交有文件上傳的表單(通過http模擬上傳文件)
  • asp頁面提示Response 對象 錯誤 ASP 0156 : 80004005 HTTP 頭錯誤
  • asp中利用xmlhttp抓取網(wǎng)頁內(nèi)容的代碼
  • Asp 使用 Microsoft.XMLHTTP 抓取網(wǎng)頁內(nèi)容并過濾需要的
  • asp中使用MSXML2.ServerXMLHTTP實現(xiàn)異步請求例子
  • 解決ASP中http狀態(tài)跳轉(zhuǎn)返回錯誤頁的問題

標(biāo)簽:揭陽 來賓 南寧 唐山 迪慶 甘南 滁州 淮北

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Asp WinHttp.WinHttpRequest.5.1 對象使用詳解 偽造 HTTP 頭信息》,本文關(guān)鍵詞  Asp,WinHttp.WinHttpRequest.5.1,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Asp WinHttp.WinHttpRequest.5.1 對象使用詳解 偽造 HTTP 頭信息》相關(guān)的同類信息!
  • 本頁收集關(guān)于Asp WinHttp.WinHttpRequest.5.1 對象使用詳解 偽造 HTTP 頭信息的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    嘉黎县| 长子县| 宝山区| 屏山县| 中宁县| 道孚县| 苏州市| 汪清县| 普兰店市| 四会市| 灵台县| 台江县| 永康市| 岱山县| 闻喜县| 衡东县| 剑川县| 彭州市| 根河市| 夹江县| 琼中| 古蔺县| 汉中市| 赤峰市| 肥乡县| 阜城县| 丰城市| 莱西市| 周口市| 富川| 石渠县| 宜都市| 凉城县| 天祝| 阳东县| 麻阳| 明溪县| 合水县| 象山县| 绩溪县| 隆化县|