HTTP Tunneling Revealed: Part 1/3 - More on iNET and XMLHTTP (Page 3 of 6 )
Even with these problems, it was a major tool and was quite publicized by Microsoft for its functionality, that later evolved into XMLHTTP and ServerXMLHTTP. In the example below I will demonstrate how it can be used to retrieve information from other servers, in this case Amazon.com. Amazon's URI, if provided with an ISBN, returns the book details, i.e. http://www.amazon.com/exec/obidos/ASIN/0764549529. The 0764549529 is the ISBN of Java Web Services programming. This example is for educational purposes only. For commercial usage, one must read the terms and conditions for the affiliate programs provided.
Hot Tip: The header prefix -- aspcompat=true -- makes .Net pages backwards compatible with classic asp pages.
To demonstrate what I've just been talking about, take a look at the following code, which I've saved to a file called inetinfo1.aspx:
<%@ Page aspcompat=true %> <% dim URL, inet, resultant
'// The URL to download the book information with ISBN 0764549529 URL = "http://www.amazon.com/exec/obidos/ASIN/0764549529" '// Instantiating Inet Control inet = Server.CreateObject ("InetCtls.Inet") '// timeout adjustment inet.RequestTimeOut = 20 '// Assign the URL inet.Url = URL '// let the variable resultant download and hold the file resultant = inet.OpenURL() Response.write ("<h1> This is an example using InetInfo</h1>") response.write (s) %>
Here's the output from this code:
Since classic ASP doesn't have the rich I/O libraries that are required for generating server requests, or say HTTP "spoofing" -- i.e. pretending that it's just another web browser asking for info from the site. The solution was to write a component, but people found it a lot easier to purchase one of the third party components designed for this purpose.
Finding the right time, market space and venue for commercial COM components that retrieve data from other web sites via HTTP requests was crammed. ServerObjects, the mega tools and components company, has launched AspHTTP, while AlphaSierraPapa released their AspTear. Later on, the Release of XMLHTTP and ServerXMLHTTP gave development a leading edge but ASPHTTP and ASPTear had already captured a good market.
AspHTTP 3.5 has support for all major platforms including Windows 9X, Millennium, NT and 2000.
This component allows the generic GET/POST/HEAD documents via HTTP, exposes HTTP response headers, supports transferring requests to a file (including binary transfers), password authentication support and more. The latest version is claimed to be 2-3 times faster than previous versions.
AspHTTP uses the Winsock API rather than the WinInet API, documenting Microsoft's acknowledged problems as we discussed earlier. Their clientele included blue-chip companies like Bank of America, Dialog, UUNET, Trane, Visa, Sony and many others.
ASPTear is a counterpart doing a similar job. Their explanation of requesting outputs is interesting, showing the SSI and Ddstributed EDI in a connected way, as it reads:
"Have you ever wanted to write an ASP page that did the following: execute an ASP script on another web server; retrieve that remote ASP script's output; and act on that output? Or perhaps you've always wanted to be able to do remote Server Side Includes, like <!--#include file="http://www.someserver.com/somefile.txt"-->. ASP, alone, can't do that sort of thing. There are, however, third party components that will!"
Its latest version, ASPTear 1.50, is documented as having the following features: