How to fetch a URL in ASP

Posted on 2006-04-07
Last Modified: 2010-07-27

This question refers to ASP, not to ASP.NET.

Given a URL, I need to download a page and put it's body into a variable.

This needs to happen at the server-side.  Because of the nature of my application, to download this in javascript or browser-side vb is unacceptable.  It must be downloaded by the server, and not by the web browser.

Thank you,
Question by:NickJohnson
    LVL 12

    Accepted Solution

    strURL = ""
    Set oXML = Server.CreateObject("MSXML2.ServerXMLHTTP")

    oXML.Open "GET", strURL, False

    If (oXML.readyState <> 4) Or (oXML.Status <> 200) Then
          strVariable = "ERROR"
          strVariable = oXML.ResponseText
    End If
    Set oXML = Nothing

    Response.Write strVariable
    LVL 1

    Author Comment

    Does this require the page's content to be valid xml?
    LVL 12

    Expert Comment

    LVL 1

    Author Comment

    Awesome; just checked it, it works.


    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
    Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now