ASP HTTP Usage Examples

Source: Internet
Author: User
Simple example:
Using this component is very simple
1. Creating objects
2. Set some properties
3. Call the Geturl method
Here is the sample code for VBScript using Asphttp
Set httpobj = Server.CreateObject ("Asphttp.conn")
Httpobj.url = "Http://www.myfinancialpage.com/qrtresults.html"
strresult = Httpobj.geturl
Variable strresult now contains a string from http://www.myfinancialpage.com/qrtresults.html
Document results obtained by get
Example: getting GIF files
<%
REM This demo pulls a GIF image from www.microsoft.com
Server.ScriptTimeout = 240
Set httpobj = Server.CreateObject ("Asphttp.conn")
Httpobj.url = "Yun_qi_img/write.gif"
Httpobj.followredirects = False
Httpobj.requestmethod = "Get"
Httpobj.useragent = "mozilla/2.0" (compatible; MSIE 3.0B; Windows NT) "
Httpobj.savefileto = "C:write.gif"
Httpobj.geturl
Response.Write "%>
Instance: processing and displaying the URL-contained href
<body>
<%
Server.ScriptTimeout = 240
Set httpobj = Server.CreateObject ("Asphttp.conn")
Httpobj.url = "Http://www.genusa.com/asp/tools.html"
Httpobj.requestmethod = "Get"
Httpobj.useragent = "mozilla/2.0" (compatible; MSIE 3.0B; Windows NT) "
strresult = Httpobj.geturl
Response.Write "Varhrefarray = Httpobj.gethrefs
Inthrefarraylimit = UBound (varhrefarray)-1
For I = 0 to Inthrefarraylimit
Response.Write Varhrefarray (I) & "<br>" & VBCrLF
Next
%>
</body>

Related Article

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.