如何使用 vbscript 从供应商网站提取数据?
我编写了一个后映像 HTA,该映像在 XP 映像加载到计算机上后启动。 HTA 从用户收集信息(即主用户名、部门等)并根据自定义键更新注册表。管理层询问我是否可以从供应商的网站(本例中为联想)获取计算机的保修信息(特别是保修结束日期),并使用此信息更新注册表。 Lenovo 允许使用计算机类型和序列号进行匿名查找,并返回显示保修信息的页面。有没有办法使用 vbscript(或者可能是 javascript?)来解析返回的页面以获取我正在查找的数据?
提前致谢, 鳃
I have programmed a post image HTA which is launched after an XP image has been loaded onto a computer. The HTA gathers information from the user (ie primary user name, department, etc) and updates the registry under a custom key. Management has asked if I can pull the computer's warranty information (specifically the warranty end date) from the vendor's website (in this case Lenovo) and update the registry with this info. Lenovo allows anonymous lookup using computer type and serial number and returns a page showing warranty information. Is there a way using vbscript (or maybe javascript?) to parse the returned page for the data I'm looking for?
Thanks in advance,
Gill
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 HTML 解析器可能是一种更可靠的方法,但使用 VBScript 很容易通过 OLE 自动化编写 Internet Explorer 脚本。
Using an HTML parser would probably be a more robust way to do this, but it's easy with VBScript to just script Internet Explorer through OLE Automation.
您可以相当轻松地抓取返回的页面,真正需要的只是一个 HTML 解析器,然后了解您想要的信息在返回页面中的位置。我不知道有任何 VBScript HTML 解析器,但我确信它们存在。但是,如果找不到,您可以从本地运行的代码调用外部程序,这样您就可以用任意数量的语言编写页面抓取实用程序(或使用某种 grep 实用程序),这可能会执行您的操作正在寻找。
You can scrape the page that is returned fairly easily, all it really takes is an HTML parser, and then knowledge of where the information you want is located within the returned page. I do not know of any VBScript HTML parsers, but I am sure they exist. If you cannot find one, however, you can call out to an external program from locally running code, so you could write a page scraping utility in any number of languages (or use some sort of grep utility), and that may do what you are looking for.