|
Display the World population
This example displays the world population from
the US governments site .
Code :
<%
Dim objXML
Set objXML = Server.CreateObject("Microsoft.XMLHTTP")
strURL = "http://www.census.gov/cgi-bin/ipc/popclockw/index.html"
objXML.Open "GET" , strURL , False ,"",""
'send the information
objXML.Send
'if we have no errors
If Err.Number = 0 Then
'and the url is valid
If objXML.Status = 200 then
strOpen = objXML.ResponseText
'this is the start point on the page that we want
startPoint= InStr( strOpen, "<p><H1>"
)
'and this is the end point on the page
endPoint = InStr( startPoint, strOpen, "</H1>")
'store all of the rest in the variable strYahoo
strPop = Mid( strOpen, startPoint, endPoint-startPoint )
'display the part of the page we want
response.Write strPop
Else
'bad url display a message
Response.Write "Incorrect URL"
End if
Else
'if we do have an error display the description of the error
Response.Write Err.Description
End If
'clear up
Set objXML = nothing
%>
|