ASP
  Home arrow ASP arrow Getting Remote Pages with ASP
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 
Dedicated Servers 
Actuate Whitepapers 
VeriSign Whitepapers 
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? 
ASP

Getting Remote Pages with ASP
By: Justin Cook
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 45
    2004-05-10

    Table of Contents:
  • Getting Remote Pages with ASP
  • Let's Code
  • A Little Parse-ly on the Side
  • Clean Up After Yourself!

  • 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

    At the virtual BlackBerry Technical Seminar 2008, you can ask your development questions directly of Research In Motion® (RIM) experts, and take advantage of learning opportunities designed uniquely for BlackBerry solution developers. Register Today!

    Getting Remote Pages with ASP


    (Page 1 of 4 )

    This article will explain step-by-step how to retrieve a remote web page using ASP, save it locally, and avert all kinds of disaster along the way. As a bonus, I’ll provide a demonstration of how to parse our saved file for the information we really want.

    Perusing the posts on the ASP Free forums, I've stumbled upon a number of similarly interesting requests. My first reaction to these requests was to reminisce, to think about hockey pools and fine dining. My second reaction was to answer the posts. My third, following the second by mere milliseconds, was the realization that the answer will take up a couple of pages, so why not write an article on the subject, so that all can benefit?

    To clarify: a number of times now I've seen people asking the same question: how the heck can I use ASP (or even just VBS) to retrieve the contents of a web page and save it locally?

    Well it so happens that at one time I was faced with that precise problem. The story goes like this: One day, I'm coding away happily, and one of my coworkers came to me in absolute distress! He was in charge of running the hockey pool at work, and a serious issue had arisen. Previously the website offering the hockey stats had provided a CSV file for download, but upon restructuring the site, had begun to provide the stats via a web page only. It was absolutely critical to have the stats in CSV format, and he promised me and my girlfriend (now wife) dinner at the fine restaurant of our choosing if I could deliver them.

    Now your needs may pale in comparison to the importance of a hockey pool (that was sarcasm...), but I promise you that after reading, your inability to step down from a challenge will be rewarded by the tools and the know-how to accomplish said task. Oh, and I'll also show you how I parsed the file after saving it.

    I have used this method quite successfully and efficiently in a publishing process built into my Content Management System, but once again, not nearly as important as hockey statistics.

    Keep in mind please, that at the time web services were not available for use. Also, this was classic ASP that I was using, not .NET, with which you handle this task much differently.

    Before We Proceed

    This article will make use of the MSXML2.ServerXMLHTTP object as well as the Proxy Configuration Tool provided by Microsoft. Make sure you have both of these installed on the machine from which the script is running. If through ASP, they need to be installed on the server, and if through VBS, on your client machine.

    You can find the Microsoft XML parser 3.0 sp4 here (http://www.microsoft.com/downloads/details.aspx?FamilyId=C0F86022-2D4C-4162-8FB8-66BFC12F32B0&displaylang=en), and the proxy configuration tool here (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winhttp/http/proxycfg_exe__a_proxy_configuration_tool.asp).

    More ASP Articles
    More By Justin Cook


     

    ASP ARTICLES

    - ADO for the Beginner
    - ADO.NET 101: Data Rendering with a DataGrid ...
    - Introducing SoftArtisans OfficeWriter 3.0 En...
    - Getting Remote Files With ASP
    - The Real Basics of Functions in ASP
    - Enhancing Readability with ASP
    - Mimicking PHP's String Formatting Functions
    - Windows Server Hacks 12, 77, and 98
    - How to Sort a Multi-Dimensional Array
    - Developing an Information Management Tool wi...
    - What are Active Server Pages?
    - Getting Remote Pages with ASP
    - FTP’ing Files with ASP
    - Apply Single-Sign-On to Your Application
    - Easy Error Management





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway