Integrate Web Content

How many times have you come across a Web site that contained a
few small kernels of interesting information and wanted to capture
it for display on one of your own pages? You might consider using
a frame, but doing so doesn't let you manipulate the content. As an
alternative, try the Internet Transfer control.

The Internet Transfer Control is an ActiveX COM component that allows
you to easily implement the most common Internet protocols, HTTP and
FTP, with COM-compatible programming languages like Visual Basic and
VBScript. In essence, the Internet Transfer Control provides a wrapper
for the numerous WinInet API functions provided by the Windows
operating system. The control comes with several Microsoft products,
including Visual Studio and Office Developer. You can check your
System directory for the file MSINET.OCX, if you're not sure you have
it registered on your system. To use this control you call it's
openUrl method. This fills a string variable with the URL's raw
html from which you can parse a specific value.

<body>
Weather for San Francisco:
<%
set objInet = CreateObject("InetCtls.Inet")
objInet.requestTimeout = 20

objInet.url = "http://weather.noaa.gov/weather/current/KSFO.html"
strHTML = objInet.openURL
if strHTML = "" then
strHTML = "<No Data Available>"
end if

strHTML = mid(strHTML, instr(strHTML, " Temperature ") + 73)
strHTML = mid(strHTML, 1, instr(strHTML, "C)") + 1)
Response.Write strHTML
Set objInet = Nothing
%>
</body>

Of course, this control may not always be suited to conditions
involving high traffic, low bandwidth, or slow connection speeds.
That said, however, the Internet Transfer Control can still
serve many useful functions.

You might also like...

Comments

ElementK Journals

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“An expert is a man who has made all the mistakes that can be made in a very narrow field” - Niels Bohr