|
ASPTear COM Object Sample
What about a simple component for "tearing"
web pages from a server? AspTear allows you to retrieve web pages
from servers easily with a bunch of features. More information can
be found at http://www.alphasierrapapa.com/IisDev/Components/AspTear
The following is a working sample of how this component
works on Active Server hosting accounts. There are literally thousands
of other combinations, colors, methods, etc that could be used to
accomplish the same function. Please note that we do not provide
support for this sample. It is only provided as a guide to help
you get started.
All the ASP code is documented. What is not documented is the plain
HTML tables which were added for aesthetic purposes.
You can download the file by clicking
here. Or try the sample by clicking
here.
This is what the ASP code looks like:
<CENTER>
<BR><BR>
<Form Name="form1">
http:// <Input Type="text" Size="30" Name="URL2"
Value=""><BR>
<Input Type="submit" Value="Tear URL">
</Form>
<table bgcolor="red">
<tr>
<td>
<%
If
Len(Request("URL2")) > 0 Then
Const
Request_POST = 1
Const
Request_GET = 2
Set
xobj = CreateObject("SOFTWING.ASPtear")
Response.ContentType
= "text/html"
On
Error Resume Next
'
URL, action, payload, username, password
strRetval
= xobj.Retrieve("http://" & Request("URL2"),
Request_GET, "", "", "")
If Err.Number <> 0 Then
Response.Write
"<b>"
If
Err.Number >= 400 Then
Response.Write
"Server returned error: " & Err.Number
Else
Response.Write
"Component/WinInet error: " & Err.Description
End
If
Response.Write
"</b>"
Response.End
End
If
Response.Write
strRetval
Else
Response.Write
"The Teared page will be displayed within this Red Frame."
End
If
%>
<td>
</tr>
</table>
</CENTER>
And this is what it looks like in a web browser:
|