|
List of free |
| Get external pages |
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.
In the bottom you will find some scripts prepared from this basic code.
| GetexternalURL.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
|
Check domain name availability (?)
We will try to get to main page of a domain name we want to search for availability. In case we are able to conect to it, then the domain name will not be available. If we are not able to connect to the requested domain name it does not neccessary mean the domain name is not available (the domain name may not be available, but we are unable to connect to the server).
In this case we will ask to the server for headers, not for page content
(it is not necessary to get all the page to know whether a domain name
is hosted somewhere).
| DomainAvailability.asp |
| <%
' Intruduce the url you want to visit GotothisURL = "http://www.submitside.com" ' Create the xml object
' ResponsePage is the response, then print it out to the page
Set GetConnection = Nothing
|
If we are able to connect to a server with the specified domain name
we will get a response like this:
Server: Microsoft-IIS/5.0 Date: Thu, 25 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
In the example above we have request for all headers (check code in
bold in the script), but we may request only for specific headers just
by changing line 12 in the script:
To request for Server: GetResponse = GetConnection.getResponseHeader("Server")
To request for Date: GetResponse = GetConnection.getResponseHeader("Server")
|
|
Create word search puzzles with your own words
|
2008@ AspTutorial.info. All rights reserved.