Home arrow ASP arrow Page 5 - HTTP Tunneling Revealed: Part 1/3
ASP

HTTP Tunneling Revealed: Part 1/3


What do the iNet control, XMLHTTP and web services have in common? They all use HTTP tunneling. In this 3 part series, Adnan gets under the hood and shows us exactly what HTTP tunneling is.

Author Info:
By: Adnan Masood
Rating: 4 stars4 stars4 stars4 stars4 stars / 50
October 17, 2002
TABLE OF CONTENTS:
  1. · HTTP Tunneling Revealed: Part 1/3
  2. · What is HTTP Tunneling?
  3. · More on iNET and XMLHTTP
  4. · ASPTear In Action
  5. · A ServerXMLHTTP Example
  6. · Conclusion

print this article
SEARCH DEVARTICLES

HTTP Tunneling Revealed: Part 1/3 - A ServerXMLHTTP Example
(Page 5 of 6 )

<%@ Page aspcompat=true %>
<% Dim objXMLHTTP, xml, flightnumber, url
'//Reading flight number from query string
flightnumber=request("flightnumber")

' Create an Server xmlhttp object:
xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
url = "http://shop.baa.co.uk/cgi-bin/ncommerce3/ExecMacro/flights/arrivals.d2w/report ?flightnumber="&cstr(flightnumber)&"&comingfrom=& hour=Hour&min=Min& hourselect=0&minselect=0& airport=LHR&timeframe=& terminalselect=0&terminal=All"
' Opens the connection to the remote server.
xml.Open ("GET", url, False)

' Actually Sends the request and returns the data:
xml.Send
Response.Write ("<h1>This is generated results from BAA using Server XMLHTTP </h1>") Response.Write (xml.responseText)
xml = Nothing
%>


Depicting BAA's GET Request Results for flight info

Handling POST requests using ServerXMLHTTP
It's quite simple to do POST requests to remote web sites. I demonstrate below how to query www.imdb.com (Internet Movie Database) for "My big fat Greek wedding", one of the most hilarious comedies of the year:

<%@ Page aspcompat=true Debug="true"%>
<%
Dim objXMLHTTP, xml, flightnumber, url
' Create an Server xmlhttp object:
xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
url = cstr("http://www.imdb.com/Find")
xml.Open ("POST", url , False)
xml.Send ("select=All&for=My big fat Greek wedding")
Response.Write ("<h1>This is generated results from IMDB using Server XMLHTTP </h1>")
Response.Write (xml.responseText)
xml = Nothing
%>


POST Results from IMDB

This is almost the same as get, however the Open method argument was replaced with POST, and the send method now includes POST data.

The syntax for data via post is the same as a query string, but the question mark "?" used to signify the start of the URL query string is now eliminated.
blog comments powered by Disqus
ASP ARTICLES

- Central Scoreboard with Flash and ASP
- Calorie Counter Using WAP and ASP
- Creating PGP-Encrypted E-Mails Using ASP
- Be My Guest in ASP
- Session Replacement in ASP
- Securing ASP Data Access Credentials Using t...
- The Not So Ordinary Address Book
- Adding and Displaying Data Easily via ASP an...
- Sending Email From a Form in ASP
- Adding Member Services in ASP
- Removing Unconfirmed Members
- Trapping HTTP 500.100 - Internal Server Error
- So Many Rows, So Little Time! - Case Study
- XDO: An XML Engine Class for Classic ASP
- Credit Card Fraud Prevention Using ASP and C...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials