[ASP] 리모트사이트의 페이지를 그대로 긁어오고 싶으면..

ms사에서 제공하는 MSXML2.ServerXMLHTTP라는 걸 이용해도 되는데..
요게 안될때가 많다.

요걸 쓰는 방법은..
<%
url = "http://time.hani.co.kr/hanitime/include/nav_family.txt"
Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP")

xmlHttp.open "GET",url, false

xmlHttp.send()

response.binaryWrite xmlHttp.responseBody
set xmlHttp= Nothing
%>

그래서 무지 고생끝에 찾아낸게.. urlfetch라는 프리컴포넌트다..
하지만 부하가 심한곳에서는 느려지는 단점이 있다.
그렇지 않은 곳에서는 유용하게 쓸수 있을것이다.
system32 폴더에 넣고 코맨드 창에서 그 폴더로 들어간후
regsvr32 urlfetch.dll 해주면 컴포넌트 등록되고 쓸수 있다.

<%
'create the object
Set URLFetchObj = Server.CreateObject("URLFetch.URLFetch")

'set the URL you want to retrieve (URLFetch assumes a GET
'request if you don't give it any POST data)
URLFetchObj.SetURL("http://time.hani.co.kr/hanitime/include/nav_family.txt")

'fetch the contents of the URL into the variable sResponse
sResponse = URLFetchObj.Fetch()

'write out the contents of sResponse to the client
Response.Write(sResponse)

'clean up after yourself!
Set URLFetchObj = Nothing
%>

Comments

Powered by Facebook Comments

댓글 남기기

당신의 이메일은 공개되지 않습니다. 필수 입력창은 * 로 표시되어 있습니다.

*

다음의 HTML 태그와 속성을 사용할 수 있습니다: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>