iASP_HTTP Component

iASP_HTTP allows you to GET/POST/HEAD documents using the HTTP protocol. This component contains different types of properties and methods.


Use the following links to view the details :

Properties

Methods

Steps To Use The Control

Samples

Appendix A

Appendix B

Appendix C

Appendix A  shows different types of methods with their return values.
Appendix B  shows different types of variables with their default values.
Appendix C   shows different types of errors with their constant values.


Properties

Up


Methods

Up


Steps For Using iASP_HTTP:

Up

  1. Set the URL by using 'Url'Property.

    e.g

    Set Conn = Server.CreateObject("IAspHttp_Conn")
    Conn.Url = "http://halcyonsoft/"
     
  2. Set the RequestMethod to desired method by using 'RequestMethod' Property.

    e.g

    Conn.RequestMethod = "GET"

    NOTE:
    Set the time by using 'Timeout' Property. This Property is used to set the total time for getting a file. By default time is set to 0 (milliseconds).

    e.g

    Conn.Timeout =  6 (Sec)
  3. After setting Url ,RequestMethod, and Timeout you can use GetURL method.See Appendix A for more details.

    e.g

    a) Conn.GetURL
    b) Conn.GetHREFs
    c) Conn.getHeader(String)
  4. You can save a downloaded file to your local System

    e.g

    a) Conn.Url ="http://halcyonsoft/"
    b) Conn.SaveFileTo="download.html"
    c) Conn.RequestMethod="Get"
    d) Conn.GetURL


ASP Samples

Up

Sample#1

<%

    Set Conn=Server.CreateObject("AspHTTP.Conn")
    Conn.Url="http://halcyonSoft"
    Conn.RequestMethod="Get"
    Response.Write Conn.GetURL

%>


Sample#2

<%

    Set Conn=Server.CreateObject("AspHTTP.Conn")
    Conn.Url="http://waseem"
    Conn.RequestMethod="Get"
    Conn.SaveFileTo = "c:\sample2.html"
    Conn.GetURL

%>


Sample#3

<%

    Set Conn=Server.CreateObject("AspHTTP.Conn")
    Conn.Url="http://Iftikhar"
    Conn.Proxy = "hserver:80"
    Conn.RequestMethod="Get"
    Conn.SaveFileTo = "c:\sample2.html"
    Conn.GetURL

%>


Sample#4

<%

    Set Conn=Server.CreateObject("AspHTTP.Conn")
    Conn.Url="http://Iftikhar"
    Conn.Proxy = "hserver:80"
    Conn.RequestMethod="Get"
    Conn.SaveFileTo = "c:\sample2.html"
    Conn.GetURL

%>


Sample#5

<%

    Set Conn=Server.CreateObject("AspHTTP.Conn")
    Conn.Url="http://Iftikhar"
    Conn.RequestMethod="Get"
    Conn.SaveFileTo = "c:\sample2.html"
    Conn.GetURL
    varHREFArray = Conn.GetHREFs
    intHREFArrayLimit = UBound(varHREFArray)
      For I = 0 to intHREFArrayLimit
        Response.Write varHREFArray(I) & "<br>" & VBCrLF
      Next

%>


Sample#6

<%

    Set Conn=Server.CreateObject("AspHTTP.Conn")
    Conn.Url="http://Iftikhar/index.html"
    Conn.RequestMethod="Get"
    Conn.SaveFileTo = "c:\sample2.html"
    Conn.GetURL
    Response.Write Conn.Headers

%>

NOTE: Errors execute only when there is any abnormal communication.


Appendix A 

Up

Methods

Description

  public String GetURL()  It returns the file from the server if SaveFileTo is not set otherwise the file is stored in the file.
  public String[] GetHREFs() It returns the list of the hyper references in the file
accessed through the GetURL method.
  public String getHeader(String) It returns the Header value of the given header after calling GetURL method.

 


Appendix B

Up

Type 

Variables

Values (default)

  public String   Accept   */*
  public String   Authorization ""
  public String    ContentType ""
  public String   ERROR NO_ERROR
  public Boolean   FollowRedirects  true
  public int    TimeOut  0 seconds
  public String   Headers ""
  public int   Port 80
  public String   Proxy ""
  public String   PostData  ""
  public String   Protocol  HTTP/1.0
  public String    RegisteredUser ""
  public String   RequestMethod GET
  public String    Url ""
  public String   UserAgent Mozilla/4.5b1 [en] (Win95; I)
  public String   Version 1.0


Appendix C

Up

Errors

Constants

  No_Error  0
  Error_in_processing_request  1
  Invalid_Header_Field  2
  Invalid_Http_Request_Method  3
  Empty_Data_Field=  4
  Invalid_Port_Or_Host  5
  Invalid_URL  6
  Proxy_Error  7
  Transfer_Interrupted  8


If you require technical support please send complete details about the problem you are having to support@halcyonsoft.com.


Copyright © 1998-2000, Halcyon Software Inc. All rights reserved.