我使用了一个批处理和Java脚本的组合,我发现使用批处理文件从网站中检索html,而我们的一个地址没有返回所需的输出,因为它在我使用url Firefox浏览器。脚本没有正确地收到URL
我使用拉HTML的脚本是:
@if (@[email protected]) @then
@echo off
rem **** batch zone *********************************************************
setlocal enableextensions disabledelayedexpansion
rem Batch file will delegate all the work to the script engine
if not "%~1"=="" (
cscript //E:JScript "%~dpnx0" %1
)
rem End of batch area. Ensure batch ends execution before reaching
rem javascript zone
exit /b
@end
// **** Javascript zone *****************************************************
// Instantiate the needed component to make url queries
var http = WScript.CreateObject('MSXML2.ServerXMLHTTP.6.0');
// Retrieve the url parameter
var url = WScript.Arguments.Item(0)
// Make the request
http.open("GET", url, false);
http.send();
// If we get a OK from server (status 200), echo data to console
if (http.status === 200) WScript.StdOut.Write(http.responseText);
// All done. Exit
WScript.Quit(0);
我想喂脚本的URL是http://gatherer.wizards.com/Pages/Search/Default.aspx?output=spoiler&method=visual&action=advanced&set=[“阿拉伯+夜”]
或alternativly http://gatherer.wizards.com/Pages/Search/Default.aspx?output=spoiler&method=visual&action=advanced&set=[“一千零一夜” ]
问题似乎是空间/ +为没有其它URL我喂它正在使用的空间或+
的WA Ÿ我打电话的脚本拉HTML是:
call callurl.cmd "http://gatherer.wizards.com/Pages/Search/Default.aspx?output=spoiler&method=visual&action=advanced&set=["Arabian+Nights"]"
编辑:找到原来的线程的脚本是从Open a URL without using a browser from a batch file
只改变我做了Msxml2.XMLHTTP.6.0改为MSXML2.ServerXMLHTTP。 6.0因为原始脚本由于我发现的安全性而无法加载网站。
谢谢你的帮助,但我仍然无法得到输出我想HTML应列出一堆文本行,如
@ reddeath68,测试为”geturl.cmd“http://gatherer.wizards.com/Pages/Search/Default.aspx?output=spoiler&method=visual&action = advanced&set = [“Arabian + Nights”]“'我得到了指示的输出。你得到了什么? –
http://pastebin.com/YRdJrsnS是我得到的输出,它的值得注意的是,当添加到cmd行时,它将url添加为“http://gatherer.wizards.com/Pages/Search/Default.aspx?outpu? ?t =扰流板&方法= vis ?? ual&动作=高级&??设置= [“阿拉伯+夜间??”]“ 注意双重问号 –