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
- Accept
- Authorization
- ContentType
- Error
- FollowRedirects
- Headers
- Port
- Proxy
- PostData
- RegisteredUser
- Protocol
- TimeOut
- RequestMethod
- SaveFileTo
- URL
- UserAgent
- Version
Methods
Steps for Using iASP_HTTP:
- Set the URL by using 'Url' Property.
e.g
Set Conn = Server.CreateObject("IAspHttp_Conn")
Conn.Url = "http://halcyonsoft/"
- 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)
- 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)
- 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
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.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 5
<%
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 are generated only when
there is any abnormal communication.
Appendix A
Method |
Description |
public String GetURL() |
Returns the file from the server if SaveFileTo
is not set otherwise the file is stored in the file. |
public String[] GetHREFs() |
Returns the list of the hyper references in
the file
accessed through the GetURL method. |
public String getHeader(String) |
Returns the Header value of the given header
after calling GetURL method. |
Appendix B
Type |
Variables |
Default Values |
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
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.
|