Windows Scripting
  Home arrow Windows Scripting arrow Page 3 - 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 - Handling the Response


    (Page 3 of 6 )

    The XMLHttpRequest object has built two built-in properties, ResponseText and ResponseXML, which capture the data returned by the server.  The methods return the data as text or as an XML object respectively.

    result = objxmlHTTP.ResponseText

    Wscript.Echo result

    We’ll finish up by echoing back the HTML text that was returned (which happens to be the source for our form submittal page).  Our result should look something like this:

    <html>

    <head>

    <title>XMLHttpRequest Test Form</title>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    </head>

     

    <body>

    <font color="#FF0000">This form was submitted remotely.</font><p>Name : John Doe<br>

    Address : 123 My Street<br>

    </body>

    </html>

    So our complete code example would look like this:

    strPostData = “action=data&name=John Doe” _

       & “&address=123 My Street”

    actionURL = “http://images.devshed.com/af/stories/hlwc2/testform.php”

     

    Set objxmlHTTP = CreateObject(“Msxml2.XMLHTTP”)

     

    objxmlHTTP.Open(“POST”, actionURL, True)

    objxmlHTTP.setRequestHeader “Content-Type”, _

       “application/x-www-form-urlencoded”

    objxmlHTTP.Send(strPostData)

     

    result = objxmlHTTP.ResponseText

    Wscript.Echo result

     

    Set objxmlHTTP = Nothing

    More Windows Scripting Articles
    More By Nilpo/Developer Shed Staff Writer


       · 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 2 hosted by Hostway
    Stay green...Green IT