问题
I'm trying to scrape a web page using classic asp. Why, because I have an asp file that I am trying to include in 2 domains and I'd rather not have 2 copies to update.
I'm new to the whole web scraping thing and having difficulty finding a "Dummies" tutorial on how to do it with classic asp (not my preference but what I'm stuck with). I don't need anything fancy, just a grab entire source of page from here.asp and post it on myotherpage.asp.
Little help in either code or tutorials would be appreciated.
回答1:
To retrieve the HTML source from a URL in Classic ASP you can use code like this:
<%
Set obj = CreateObject("MSXML2.ServerXMLHTTP")
obj.Open "GET", "http://www.example.com/page.html", False
obj.Send ""
Response.Write obj.ResponseText
Set obj = Nothing
%>
In this example, obj.ResponseText
is the HTML source.
来源:https://stackoverflow.com/questions/42700013/web-scraping-in-classic-asp