1.

Solve : html batch?

Answer»

I need a way to retrieve html from a specific webpage WITH BATCH, and then parse it through the batch file. Any ideas?http://www.chami.com/tips/windows/062598W.html


Quote

"First, download and INSTALL URL2File Windows Application, which is the program we'll be using in this example (URL2File Windows Application is a product of Chami.com). URL2File can retrieve and save the content of a given World Wide Web URL to a local file. So, to retrieve the web page at http://www.chami.com/tips/ and save it to a local file named tips.htm, run the following command from a Windows Command Prompt/DOS Box:

URL2File http://www.chami.com/tips/ tips.htm"

Quote
I need a way to retrieve html from a specific webpage WITH BATCH, and then parse it through the batch file. Any ideas?

I doubt you can do this with batch UNLESS you run a Windows script out of a batch file. The previous post suggested a download, but that program will download the web page, not the HTML source.

This little snippet can be saved and then run from a batch file:

Code: [Select]Const url="http://www.yahoo.com/"

Set http = CreateObject("Microsoft.XMLHTTP")
Set fso = CreateObject("Scripting.FileSystemObject")

On Error Resume Next
http.open "Get", url, False
http.send ""

If Err.Number <> 0 Then
WScript.Echo "Error: " & Err.Number & ": " & Err.Description
WScript.Quit
End If

Set f = fso.CreateTextFile("Html.txt", True)
f.WriteLine http.responseText

Change the URL to whatever. The HTML source will be saved in a file named HTML.txt Save the script with a VBS extension. You can put this reference in your batch file to execute the script: cscript scriptname.vbs

Good luck.

PS. I'll leave it to you to parse the HTML code in your batch file, but it might be a whole lot easier to WRITE the entire project in VBScript.


Discussion

No Comment Found