Properties |
PostData
Data to be sent along with a POST request. Parameters
should be delineated by a &, as in the example.
URLFetchObj.PostData = "param1=foo¶m2=bar"
|
Proxy
The name of the proxy server to be used by URLFetch, including
the port number, if needed.
URLFetchObj.Proxy = "myproxy.net:3268"
|
ProxyPassword
The username and password required for the proxy server
desgnated. Note that this is not always needed.
URLFetchObj.ProxyPassword = "uname:passwd"
|
| NOTE: If you're having trouble getting URLFetch to work with
a proxy server try assigning your proxy settings to the network
connection on the server (e.g. using Internet Explorer under
Tools->Internet Options, Connections tab). URLFetch will use
these settings by default. |
Methods |
SetURL(URL)
Sets the URL that will be retrieved when the Fetch function is
called.
URLFetchObj.URL("http://www.yahoo.com/")
|
SetAuthorization(AuthorizationParameter)
Sets the Authorization parameter, allowing access into areas that
require authentication. The parameter passed to the method
should take the form username:passowrd, as in the
example. The URLFetch object will properly encode the
parameter in base64 format.
URLFetchObj.SetAuthorization("foo:bar")
|
SetHeader(Key, Value)
Sets an HTTP header. This method would be used for such
things as setting cookies and MIME types.
URLFetchObj.SetHeader("Cookie", _
"ID=foo; expires=Fri, 20-Dec-2002 15:00:00 GMT; domain=.bar.com; path=/")
|
SetIsBinary(IsBinary)
Sets a flag that indicates whether the file to be retrieved is
binary. Valid values are true and
false.
URLFetchObj.SetIsBinary( true )
|
SaveAsFile(FilePath)
Saves the data that was previously retrieved from a
Fetch as a file.
URLFetchObj.SaveAsFile( "C:\Inetpub\wwwroot\images\foo.gif" )
|
Functions |
Fetch()
Fetches the URL that has been set using the URL
property. Returns a string containing the result of the
request. NOTE: If you used the SetIsBinary method to
designate the file to be retrieved as a binary file calling
Fetch will simply return the string "binary". Use the
GetBinary function to retrieve the result of a binary
fetch.
HTTPResponse = URLFetchObj.Fetch()
|
GetBinary()
If you use the SetIsBinary method to designate the
file to be retrieved as binary, you need to use this function to get
the data that was fetched. It returns an array of bytes, and works
nicely with the Response.BinaryWrite method.
binaryResult = URLFetchObj.GetBinary()
|
GetHeaders()
Retrieves all HTTP headers sent by the remote server after an
HTTP request has been made to it. Returns a two-dimensional
array of strings.
HTTPHeaders = URLFetchObj.GetHeaders()
|
GetHeader(HeaderName)
Pass it the name of an HTTP header and it will return its value
for the document just fetched. Note that this doesn't correlate to
SetHeader
in that it will not retrieve the value of the header you just set;
rather, it retrieves the value of the HTTP header from the document
you just retrieved.
HTTPHeader = URLFetchObj.GetHeader( "Content-Type" )
|