Web Page Changed, Winbatch Script Now Only Download's Gibberish

Started by mcjathan, May 25, 2016, 08:34:11 AM

Previous topic - Next topic

mcjathan

Hi all,  I have a Winbatch script that daily downloads this webpage:

     http://www.wrh.noaa.gov/slc/aviation/SLCSRG.php

Recently, the provider of this page did a major overhaul of the page.  My Winbatch script that used to save this page beautifully now downloads gibberish. Here's the relevant Winbatch code:

Quote#DefineFunction Download_File(URL, File)
   If FileExist(File) Then FileDelete(File)
   tophandle = iBegin(0,"","")
   datahandle = IUrlOpen(tophandle,URL)
   iReadData(datahandle,File)
   iClose(datahandle)
   iClose(tophandle)
#EndFunction

Can anyone offer suggestions how I can change my code to once again capture this web-page properly?

Regards,

Jeff

td

Likely a javascript issue.  Perhaps try COM Automation instead:

Code (winbatch) Select
url = 'http://www.wrh.noaa.gov/slc/aviation/SLCSRG.php'
file = 'C:\temp\dump.txt'
If FileExist(File) Then FileDelete(File)
objMsie = ObjectCreate("InternetExplorer.Application")
objMsie.addressbar = @FALSE
objMsie.statusbar = @FALSE
objMsie.menubar = @FALSE
objMsie.toolbar = @FALSE
objMsie.visible = @FALSE
objMsie.navigate(url)
While objMsie.busy || objMsie.readystate <> 4
   TimeDelay(0.5)
EndWhile
FilePut(file,objMsie.document.GetElementsByTagName("HTML").item(0).outerHTML)
objMsie.quit
objMsie = 0
Run('notepad.exe', file)


There are more and better examples in the Tech Database.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade