게시판 본문 ASP, ASP.NET, IIS & Script - Read Only
re: 전통적인 ASP 환경에서 작업하는 경우 |
---|
작성자: 송원석
작성일시: 2005-09-28 21:49,
조회수: 6,413
|
이 경우에는 다음의 함수를 사용하시면 됩니다. 제가 직접 작성한 함수는 아니고 예전에 구글에서 발견해서 정리해 놓았던 코드입니다. 원본의 출처는 기억이 잘 나지 않는군요. 참고하시기 바랍니다.
Public Function SaveWebBinary(strUrl, strFile) Const adTypeBinary = 1 Const adSaveCreateOverWrite = 2 Const ForWriting = 2 Dim web, varByteArray, strData, strBuffer, lngCounter, ado On Error Resume Next Err.Clear Set web = Nothing Set web = CreateObject("WinHttp.WinHttpRequest.5.1") If web Is Nothing Then Set web = CreateObject("WinHttp.WinHttpRequest") If web Is Nothing Then Set web = CreateObject("MSXML2.ServerXMLHTTP") If web Is Nothing Then Set web = CreateObject("Microsoft.XMLHTTP") web.Open "GET", strURL, False web.Send If Err.Number <> 0 Then SaveWebBinary = False Set web = Nothing Exit Function End If If web.Status <> "200" Then SaveWebBinary = False Set web = Nothing Exit Function End If varByteArray = web.ResponseBody Set web = Nothing Set ado = Nothing Set ado = CreateObject("ADODB.Stream") If ado Is Nothing Then Set fs = CreateObject("Scripting.FileSystemObject") Set ts = fs.OpenTextFile(strFile, ForWriting, True) strData = "" strBuffer = "" For lngCounter = 0 to UBound(varByteArray) ts.Write Chr(255 And Ascb(Midb(varByteArray, lngCounter + 1, 1))) Next ts.Close Else ado.Type = adTypeBinary ado.Open ado.Write varByteArray ado.SaveToFile strFile, adSaveCreateOverWrite ado.Close End If SaveWebBinary = True End Function코드가 무척 흥미롭다는 것을 알 수 있으실 것입니다. ^_^ 감사합니다. |
IP 주소: 211.226.151.37
|
전체 2 건의 댓글이 존재합니다.
송원석 |
다음의 사이트가 원본 코드의 출처입니다. 겨우 찾았네요. 또 다른 흥미로운 코드들을 많이 발견하실 수 있으실 것입니다.
|
2005-09-28 21:58 |
송원석 |
2005-09-28 21:59 |
전체 2,095 건의 게시물,
84 페이지로 구성된
ASP, ASP.NET, IIS & Script 게시판의
1 페이지입니다.
게시물 | ||||
---|---|---|---|---|
2,208 | 2011-05-25 | 11,829 | ||
2,207 | 2011-05-27 | 5,553 | ||
2,206 |
이석환 |
2011-05-20 | 124 | |
2,205 | 2011-05-23 | 5,402 | ||
2,204 |
이석환 |
2011-05-17 | 130 | |
2,203 | 2011-05-17 | 5,213 | ||
2,202 |
동영상 탑재 사이트 구축 [1] |
2011-05-12 | 5,085 | |
2,201 | 2011-05-12 | 5,019 | ||
2,200 | 2011-04-24 | 5,335 | ||
2,199 | 2011-04-25 | 4,926 | ||
2,197 |
김종식 |
2011-03-30 | 228 | |
2,196 | 2011-03-31 | 5,028 | ||
2,195 |
gosuzzang |
2011-03-23 | 290 | |
2,194 | 2011-03-24 | 5,462 | ||
2,193 |
이석환 |
2011-03-23 | 253 | |
2,192 | 2011-03-24 | 5,378 | ||
2,191 |
이석환 |
2011-03-18 | 345 | |
2,190 | 2011-03-19 | 5,725 | ||
2,189 | 2011-03-21 | 5,040 | ||
2,188 |
이석환 |
2011-03-21 | 258 | |
2,187 | 2011-03-21 | 5,473 | ||
2,186 |
질문 |
2011-03-18 | 311 | |
2,185 | 2011-03-18 | 7,412 | ||
2,184 |
이석환 |
2011-03-11 | 345 | |
2,183 | 2011-03-14 | 8,452 |