1283 characters | 43 lines | 1.25 KB
DOWNLOAD | RAW | EMBED | CREATE NEW VERSION OF THIS PASTE | REPORT ABUSE | x
  1. <%@LANGUAGE="VBSCRIPT"%>
  2. <%
  3. 'gather the required Query Parameters URL, Format, Encoding
  4. dim url
  5. url = Request.QueryString("url")
  6. If url<>"" Then  
  7.     url = "http://example.com"
  8. End If
  9.  
  10. dim format
  11.         format = Request.QueryString("f")
  12. If format<>"" Then       
  13.      format = "text/plain"
  14. End If
  15.  
  16. dim encoding
  17.         encoding = Request.QueryString("e")
  18. If encoding<>"" Then     
  19.     encoding = "UTF-8"
  20. End If
  21.  
  22.  
  23. 'create a unique instance NONCE to ensure proxied calls are not cached
  24. dim instanceID
  25.         instanceID = Session.SessionID
  26.  
  27.  
  28. 'perform the HTTP Request
  29. dim xmlhttp
  30.         set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
  31.         xmlhttp.Open "GET",url&"instanceID="&instanceID,false   'IF doing a POST:   use --> "POST",url,false
  32.         '"":   set DataToSend = value   then call --->   xmlhttp.send DataToSend
  33.         '"":   also set Content-Type of POST body --->   xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  34.  
  35.        
  36. 'display the response
  37. Response.ContentType = format       'May want to check IF ContentType == "text/xml"
  38. Response.Charset = encoding         'UTF-8 should be fine for most uses unless not supported, then go with:  
  39. Response.Write xmlhttp.responseText 'IF ContentType == "text/xml":   Response.Write xmlhttp.responsexml.xml
  40. Response.End()
  41. Set xmlhttp = nothing
  42.  
  43. %>