Simple instance:
Use this component very simple
1. Create an object
2. Set some properties
3. Call the getURL method
Below 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
The variable Strresult now contains a string from http://www.myfinancialpage.com/qrtresults.html
Get obtained document results
Example: Get a GIF file
<%
Rem this demo pulls a gif image from www.microsoft.com
Server.scripttimeout = 240
Set httpobj = server.createObject ("asphttp.conn")
Httpobj.url = "http://www.microsoft.com/library/images/gifs/toolbar/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 "
" & httpobj.headers & " pre>"%>
Example: Handling and displaying the HREF included in the URL
<%
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 "
a href list h2>"
VarhrefaRray = httpobj.gethrefs
INTHREFARRAYLIMIT = Ubound (Varhrefarray) -1
For i = 0 to inthrefarrayLimit
Response.write Varhrefarray (i) & "& vbrlf
NEXT
%>
body>
html>