/* An example of downloading an HTML page from the internet, * and print it as raw text to the display. */ /* ========================= STEP 1 ========================== * Load RexxInet functions. Set up error handling for RexxInet. * Have it raise ERROR condition. This is done once at the * start of our script. */ /* Load REXXINET.DLL and register all its functions. */ LIBRARY rexxinet InetErr = "ERROR" InetHeading = 1 /* ========================= STEP 2 ========================== * Make sure we're connected to the internet (if a dial-up * account), and initialize RexxInet. */ DO /* Make sure we're connected to the internet. If not, * automatically connect the default account. */ InetDial("ONLINE") /* Initialize REXXINET. We tell WinINet that our script name is "My test" */ InetOpen(, , "My test") /* Let's CATCH ERROR so we don't have to error check * any of the above calls to RexxINet functions. Yay! */ CATCH ERROR CONDITION('M') RETURN END /* ========================= STEP 3 ========================== * Download a web page (ie, HTML file). */ /* Here's my URL. I could pass this directly to InetConnectUrl if desired. */ myURL = "http://www.microsoft.com/msj" /* Connect to the server that hosts the page, and tell it the page we want. * Read that page into our variable named "MyPage". */ InetConnectUrl(myURL, "MyPage", "RESYNC|DOWNLOAD") /* If desired, you can now download another page by looping back to * InetConnectUrl() and passing it a different URL. */ SAY MyPage /* Done */ RETURN /* ================ Error handling and cleanup ================ */ CATCH ERROR CONDITION('M') FINALLY /* Terminate use of RexxInet and disconnect from the internet. * NOTE: If our main script ends without doing this, then * RexxInet implicitly does this for us. */ InetClose()