Experience exchange of Acquisition programming (II.)--Download Web page

Source: Internet
Author: User

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

Experience exchange of Acquisition programming (II.)--download page (1)

"Small sites do not need maintenance, just because your program is too stupid, so you become an endless website maintainer." ”

Web download Method 1 (XMLHTTP application)

Objects to use: XMLHTTP, just three lines of code, you can complete the Web download:

First step: Create an Object

Set ms = CreateObject ("Microsoft.XMLHTTP")

This line of code is used to create a XMLHTTP object, where MS is the name of the object to create, ASP programming is often used, you can write casually, no longer repeat.

Step two: Set the parameters

Ms.open "Get", Url,false

Where the URL is to download the Web page URL, replace it with your target Web site can be, the format is: http://www.99jpw.cn, must write complete, can not omit http://;

"Get" is an open method, and of course it can be post, with the same effect as the form submission in HTML.

Step three: Send data

Ms. Send ()

This line of code is used to send and download data, and the downloaded data is stored in the variable responsebody.

Below we download "Dot Point ticket Network (http://www.66666999.com)" Home as an example to explain

Code:

Set ms = CreateObject ("Microsoft.XMLHTTP")

Ms. Open ' get ', ' http://www.99jpw.cn ', False

Ms. Send ()

Response.Write Ms.responsebody

Run the above code you can find that we have successfully downloaded the http://www.66666999.com

Here's a question to note, 8630.html "> Sometimes the site is very long, directly added to the second line of code will appear very messy, then we can use a variable to replace the following:

Url= "http://www.99jpw.cn"

Set ms = CreateObject ("Microsoft.XMLHTTP")

Ms. Open ' get ', url, False

Ms. Send ()

Response.Write Ms.responsebody

The code has become much neater.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.