Windows Scripting
  Home arrow Windows Scripting arrow Page 6 - Handling Live Web Content in WSH - Part 2
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WINDOWS SCRIPTING

Handling Live Web Content in WSH - Part 2
By: Nilpo/Developer Shed Staff Writer
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 4
    2006-12-19

    Table of Contents:
  • Handling Live Web Content in WSH - Part 2
  • Making the Connection
  • Handling the Response
  • Handling Errors and Exceptions
  • Implementing a Workaround
  • Other Uses for XMLHttpRequest

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Handling Live Web Content in WSH - Part 2 - Other Uses for XMLHttpRequest


    (Page 6 of 6 )

    Right about now you’re probably asking what else you can do with the XMLHttpRequest object.  Well, here are a couple of other uses for you to play around with.

    object.getResponseHeader(“header”)

    The XMLHttpRequest object is also able to request a website’s headers.  It provides two different methods for doing this.  The getAllResponseHeaders() method will return all of the headers supplied by the server.  The getResponseHeader() method can be used to request a specified header only.  The following example demonstrates both.

    Set objxmlHTTP = CreateObject("Msxml2.XMLHTTP")

    objxmlHTTP.Open "HEAD", "http://www.aspfree.com", False

    objxmlHTTP.Send()

     

    Wscript.Echo “Return all headers:”

    Wscript.Echo objxmlHTTP.getAllResponseHeaders()

    Wscript.Echo “Return last modified date:”

    Wscript.Echo objxmlHTTP.getResponseHeader("Last-Modified")

     

    Set objxmlHTTP = Nothing

    As you can see, we’ve used the getAllResponseHeaders() method to return all of the headers and the getResponseHeader method to return the Last-Modified headers.  An example output might look like this:

    Return all headers:

    Date: Fri, 01 Dec 2006 20:00:05 GMT

    Server: Apache/1.3.34 (Unix)

    Set-Cookie: sessioncookie=c88b42fa00eb0b52045e8b3ce1621c5; expires=Sat, 01-Dec-2007 20:00:05 GMT; path=/

    Set-Cookie: usercookie=c88b42fa00eb0b52045e8b3ce1621c5; expires=Sat, 02-Dec-2006 08:00:05 GMT; path=/

    Set-Cookie: jamcku=nilpo; expires=Sat, 01-Dec-2007 20:00:05 GMT; path=/

    Set-Cookie: jamckp=8ad7de41a5d1bda96b57ff2ca0e0b697; expires=Sat, 01-Dec-2007 20:00:05 GMT; path=/

     

    Set-Cookie: mosvisitor=1

    Expires: Mon, 26 Jul 1997 05:00:00 GMT

    Last-Modified: Fri, 01 Dec 2006 20:00:05 GMT

    Cache-Control: no-store, no-cache, must-revalidate

    Cache-Control: post-check=0, pre-check=0

     

    Pragma: no-cache

    Keep-Alive: timeout=10, max=150

    Connection: Keep-Alive

    Content-Type: text/html

     

    Return last modified date:

    Fri, 01 Dec 2006 20:00:05 GMT

    Wipe the sweat off of your forehead and pour yourself a cold glass of tea.  The hard work is done.  You now have two more uses for the XMLHttpRequest object as well as some good methods for error-handling when using it.  That’s it for now.  I’ll catch you next time.  Until then, keep on coding!


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · After several good discussions and a good response from the first article, I decided...
     

    WINDOWS SCRIPTING ARTICLES

    - Introducing Two-Way Data Binding using Silve...
    - Silverlight 2.0 Application Development with...
    - Burning Multisession CDs with IMAPI2 in WSH
    - Creating a Silverlight 2.0 Application that ...
    - Burning CDs with the IMAPI2 Control
    - Burning CDs in Windows XP with WSH
    - Advanced Word Object Scripting
    - Reading and Printing Word Documents in WSH
    - Scripting Microsoft Word
    - Using WSH to Catalog MP3 Files
    - Reading MP3 ID3 Tags in WSH
    - A Brief Look at Menus in WPF
    - More Examples of Simplified Image Processing...
    - Completing a WPF To-Do List Application
    - Simplified Image Processing in GDI+





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT