|
>Free printable Sudoku Puzzles | Custom Word Search Puzzles | iptocountry.info | Free web storage |
| Access to remote URLs |
In this tutorial we will used Microsoft's XMLHTTP Object to request a page to a remote address from our server. This Object is included in Microsoft's XML DOM component, which is probably installed in your server.
The traditional usage of Microsoft's XMLHTTP Object is to access remote XML files. In this basic tutorial we will used it to obtain the text code from a remote server. It will be the same information our browser will get when visiting that page.
In the example bellow we have set up a variable named GotothisURL which
contains the url of the page we will asked our server to visit. The response
to this visit will be saved to variable ResponsePage.
| GetremoteURL.asp |
| <%
' Intruduce the url you want to visit GotothisURL = "http://www.asptutorial.info" ' Create the xml object
' ResponsePage is the response we will get when visiting GotothisURL
' We will write
Set GetConnection = Nothing
|
In the example avobe we may use a URL like http://www.asptutorial.info?name=Joe&lastname=Zarzandi. The example above will work with get method. You may try http://www.google.asp?q=asp to search for asp in google search engine (unfortunatelly is not legal to do so without visiting their site unless we used the method shown in the script bellow).
In the example above we have request for all content of the response page, but it is possible to request only headers (check code in bold in the script), but we may request only for specific headers. You will need to change line 12 in the script:
ResponsePage = GetConnection.getallResponseHeadersThe response page will be something similar to this:
Server: Microsoft-IIS/5.0 Date: Thu, 31 Apr 2002 14:25:20 GMT MicrosoftOfficeWebServer: 5.0_Pub Connection: keep-alive Connection:
Keep-Alive Content-Length: 11063 Content-Type: text/html Cache-control: private
We may also request for specific parts of the information included
in the headers (check a regular :
To request for Server:
ResponsePage = GetConnection.getResponseHeader("Server")
To request for Date:In the example bellow we have add some code to avoid error messages when url is not available, so that we will get a alternative text (line 17)
ResponsePage = GetConnection.getResponseHeader("Date")To request for Content Length:
ResponsePage = GetConnection.getResponseHeader("Content-Length")...
| GetremoteURL.asp |
| <%
' Intruduce the url you want to visit GotothisURL = "http://www.asptutorial.info" ' Create the xml object
' ResponsePage is the response we will get when visiting GotothisURL
' We will write
Set GetConnection = Nothing
|
|
|
Create word search puzzles with your own words
|
2008@ AspTutorial.info. All rights reserved.