Customer Service



   Frequently Asked Questions

....Domain Search:
  Website Hosting
  Co-location Services
Virus & Spam Control
Ecommerce Software
Other Software
  ITS Group Information Technology



Related Links

 Official Site

Email page
to a friend




Domain Registration

Virus & Spam Control

E-commerce Software

Why Co-locate? 

User Rating: (5/5)

 Read Testimonials

Website Hosting

Using ASPTear

Go Back

Here's a list of the component's main features:

  • Supports GET and POST
  • Send query strings and POST data to the server
  • Access HTTP and HTTPS resources
  • Log in to secured sites with username/password

So how does it work? Currently, the component is really very simple as it supports only one method (server-side VBScript pseudocode given here):

Const Request_POST = 1
Const Request_GET = 2
Set xObj = Server.CreateObject("SOFTWING.AspTear")
strRetVal = xObj.Retrieve(strUrl, nRequestType, strQueryString|strPostData, _
                 strUsername, strPassword)

The file retrieved is returned as method return value (strRetVal; errors are returned with exceptions - see the samples). If you don't need to supply Username and Password, leave them empty (""). Thus, the simplest request looks like this:

strRetVal = xObj.Retrieve("",2,"","","")

Notice that I did not supply a document - the component supports redirects! Now let's get a little bit more sophisticated: POST a form to the server with form data. How is this form data formatted? It needs to have the following form,


where value1 to n need to be URL-encoded. To URL-encode a string value, use Server.URLEncode (this is also mandatory for querystrings):

strPostData = "Name=" & Server.URLEncode("Christoph Wille") & _
              "&goto=" & Server.URLEncode("")

The call to Retrieve now looks like this:

strRetVal = xObj.Retrieve("",1,strPostData,"","")

The last thing to discuss is how to access SSL-secured items - it is as simple as replacing http:// with https:// in the strUrl parameter!

ASP Sample
This is a simple sample with two files: formpost.asp (Listing 1) which accepts a parameter and dumps it with the ALL_HTTP server variable; the second file is testretrieve.asp (Listing 2), which uses the component to retrieve the formpost.asp file and return it to the client.

Listing 1: formpost.asp

Response.Write Request.ServerVariables("ALL_HTTP")
Response.Write Request.Form("test")

<form method=post action="">
<input type=text name="test">
<input type=submit>

Listing 2: testretrieve.asp

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://DOMAINAME.COM/formpost.asp", _
                 Request_POST, "test=wille", "", "")

If Err.Number <> 0 Then
    Response.Write "<b>"
    If Err.Number >= 400 Then
        Response.Write "Server returned error: " & Err.Number
        Response.Write "Component/WinInet error: " & Err.Description
    End If
    Response.Write "</b>"
End If

Response.Write strRetval
Go Back  If you have any questions: or Phone 1-780-701-7282.



Copyright 1999-2008 ITS Group Information Technology. 1-780-701-7282