3초기억력

ServerXMLHTTP 사용법 + getOption Method 본문

플밍_ASP

ServerXMLHTTP 사용법 + getOption Method

잠수콩 2014. 4. 10. 10:42

 



제목 :  ServerXMLHTTP 사용법


소스 :

 

<%  
    ' deliberate typo:  
    url = "http://www.espn.co/main.html"  
 
    set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")  
    on error resume next  
    xmlhttp.open "HEAD", url, false  
    xmlhttp.send ""  
    status = xmlhttp.status 
    if err.number <> 0 or status <> 200 then 
        if status = 404 then 
            Response.Write "Page does not exist (404)." 
        elseif status >= 401 and status < 402 then 
            Response.Write "Access denied (401)." 
        elseif status >= 500 and status <= 600 then 
            Response.Write "500 Internal Server Error on remote site." 
        else 
            Response.write "Server is down or does not exist." 
        end if 
    else  
        sResult = xmlhttp.responseText
        sFinalURL = xmlhttp.getOption(-1)        '-1 은 최종 페이지의 URL 값

        If url <> sFinalURL Then
         Response.write "ERROR MSG : url is not The final page URL <br>"
        End If

 

        Response.Write "The final page URL (after any redirects) is " & sFinalURL & "<br/>"
        Response.Write "Server is up and URL is available."  
    end if  
    set xmlhttp = nothing  
%>


 

출처 :


 


예제 소스 파일 :


 


 

Comments