0

Is there a way to read a another page's elements and grab the whole HTML code?

let's say for example i want to get all the HTML from this page : http://localhost/test3.html

Thank you!

Alan Smith
  • 71
  • 7

1 Answers1

1

Here's a function I use:

function http_post (strUrl, data)
    ' call another URL (e.g. ASP or PHP script) via HTTP and POST. "data" should be GET-style parameter string or empty '
    dim xmlHttp
    Set xmlHttp = Server.Createobject("MSXML2.ServerXMLHTTP.6.0")
    With xmlHttp
        .Open "POST", strUrl, False
        .setRequestHeader "User-Agent", Request.ServerVariables("HTTP_USER_AGENT")
        .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
        .setRequestHeader "Content-Length", Len(data)
        .Send data
        if .Status < 400 then
            http_post = .responseText
        else
            ' do error logging here if you want '
            http_post = false
        end if
        .abort()
    End With
    set xmlHttp = Nothing
end function
Stephen R
  • 3,512
  • 1
  • 28
  • 45