푸른청년 푸르게 살고있나?  
home | 살아가기 | news | 세상보기 | tip&tech | 방명록 |  
   전체
   asp
   php
   jsp
   mssql
   mysql
   informix
   linux
   unix
   win2000
   javascript
   html
   oracle
   java
   etc
    
:: Tip&Tech > asp
리모트사이트의 페이지 긁어오기 투
asp에서는 php와 달리 리모트사이트의 페이지를 긁어오기 위해서 프리컴포넌트를 썼었는데 부하에 약한 단점이 있었다.

디폴트로 제공하는 MSXML2.ServerXMLHTTP 이걸쓰면 바이너리로 읽어와
한글에 문제가 있었는데..
아스키코드를 변환하는 함수를 통해(뉴스그룹에서 참조)
간단히 구현해 보았다.
유용하게 쓰시길..

<%
url = "http://cobbi.hani.co.kr/section-homepage/news/03/family_top.txt"
call getRemoteFile(url)

sub getRemoteFile(url)

Set oXMLHttp = Server.CreateObject("MSXML2.ServerXMLHTTP")

oXMLHttp.open "GET", url, false
oXMLHttp.send()

sXML=oXMLHttp.responseBody

sXML = getConvAscii(sXML)

response.write sXML

set oXMLHttp = nothing
end sub

Function getConvAscii(value)
Dim strV, i, s, intChr, ichr1, ichr2, strS
s = LenB(value) : strV = "" :
For i = 1 to s
intChr = AscB(MidB(value, i, 2))
if intChr > 128 then
ichr1 = intChr
i = i + 1
ichr2 = AscB(MidB(value, i, 2))
strS = "&H" & Hex(ichr1) & Hex(ichr2)
strV = strV & Chr(strS)
Else
strV = strV & Chr(intChr)
End If
Next
getConvAscii = strV
End Function

%>

테스트 페이지 --> http://bbs.hani.co.kr/aninstory/xml_test.asp

날짜: 2004-09-08 14:06:37, 조회수: 3362

다음글 urldecode 함수
이전글 다국어 게시판 만들기

꼬리말
글쓴이 비밀번호 #스팸글방지(주인장 닉네임을 쓰시오)

  
since by 2003.03.23 / 3th 2005.07.26 / 4th 2009.04.22 made by bluesoul