抓取网页的脚本 [英] Script to grab web page

查看:89
本文介绍了抓取网页的脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web应用程序,它将生成一个网页并将其放在服务器上的绝密位置。我需要一个Windows XP盒子才能在后台运行程序,检查页面是否在那里,从服务器获取此页面并在Windows打印机上打印。它应该每隔一两分钟轮询服务器。


XP Pro可用,但宁可在XP Home上运行。该页面位于服务器的未发布区域,但不需要保护。页面现在只是html,文本,但我可以容忍纯文本(暂时)。


如果这是一个''nix框,我可以使用shell脚本, wget并用10行编写一个脚本来执行此操作,但Windows上没有安装任何脚本。我甚至不想在Windows机器上安装任何东西来做到这一点,所以我想知道是否有一种等效的脚本方法可以在Windows中运行并做我想做的事情。


从google搜索一下,我看到的一切都是用VB完成的。我根本不想学习VB做一些应该是一项微不足道的工作,我很担心我需要下载和安装才能开发代码。


有人能给我一个线索吗?

给我发送密码。

这是紧急的!!!

; )

I have a web application that will generate a web page and tuck it in a top secret location on the server. I need a Windows XP box to be able to run a program in the background to check to see if the page is there and fetch this page from the server and print it on the Windows printer. It should poll the server every minute or two.

XP Pro is available but would rather it run on XP Home. The page is located in an unpublished area of the server but does not need to be secured. The page would be html, text only for now, but I could tolerate plain text (for now).

If this was a ''nix box, I could use a shell script and wget and write a script in 10 lines to do this but none of that is installed on Windows. I reeeaaaallly don''t want to have to install anything on the Windows box to do that so I''m wondering if there is an equivalent scripting method that would work with something in Windows and do what I want.

From googling a little, all I see is everything done in VB. I reeeaallly don''t want to have to learn VB to do what should be a trivial task, and I''m concerned what I would have to download and install just to develop the code.

Can someone give me a clue, please?
Send me the code.
It''s URGENT!!!
;)

推荐答案

幸运的是,MS似乎已经意识到unix shell有多强大以及它们有多么蹩脚。因此,他们开发了可以免费下载的 Windows PowerShell 。好的,你更喜欢不安装,但我想你可能想改变主意。语法似乎与bash中的语法非常相似,所以你应该快速找到它的方法。
Luckily, MS seems to have realised how powerful the unix shell and how lame theirs is. So, they developed the Windows PowerShell which can downloaded for free. OK, you preferred to install nothing, but I think you may want to change your mind for this. The syntax seems to be quite similar to that in bash, so you should find your way around it quickly.

发给我代码。

它是紧急的!!!

;)
Send me the code.
It''s URGENT!!!
;)



好​​的,因为它就是你。以下是PowerShell的两个wget版本:简单版本更强大的版本。 ^^


问候,

Nepomuk

OK, because it''s you. Here are two versions of wget for the PowerShell: simple version and more powerful version. ^^

Greetings,
Nepomuk


**叹气**

更多学习。


或者不是。


昨天我看到了PowerShell的事情并认为它是一名编辑。我也看到它已经被.NET所吸引,你必须(?)学习一些.NET的东西。


决定学习它还是在盒子上安装Windows ,下载PlatformSDK并在Win32中编码,我有经验。我不想做任何事情,但做后者感觉更舒服。我也担心强迫客户安装PowerShell只是为了运行我的小脚本会非常不方便。


我正在''nix中查看10行代码,我现在就完成了。人们想知道为什么我对Windows的感觉如此。
**sigh**
More to learn.

Or not.

I saw the PowerShell thing yesterday and thought it was an editor. I also see it''s hooked in with .NET and you must(?) learn some of the .NET stuff.

The decision is between learning that or installing Windows on a box, downloading the PlatformSDK and coding in Win32, something I have experience with. I don''t want to do either but feel more comfortable doing the latter. I''m also concerned that forcing customers to install PowerShell just to run my little script would be highly inconvenient.

And I''m looking at 10 lines of code in ''nix and I''d be done right now. People wonder why I feel the way I do about Windows.


我只是想了一些并记得 Cygwin 。它基本上为你提供了一个类似于unix的命令行,它运行bash(以及其他一些shell),所以不需要重新学习。但是你仍然需要安装一些东西。


还有办法吗?也许 - 以 win-bash 为例,这是一个旧版本的端口bash。你不必安装它,只需将exe复制到某处。如果要从Windows命令行加载它,请将exe所在的位置放在Path变量中。我从未测试过它,但听起来不错,对吧?

有类似的项目,如 GNU BASH For Windows Win32的GNU实用程序 MinGW ,可能还有更多。我不知道哪些必须安装,哪些不是,但也许你可以告诉我们更快? ^^


哦,也许只是下载 wget for Windows 也可以完成这项任务 - 这一切都取决于你想写的脚本。
I just thought some more and remembered Cygwin. It basically gives you a unix-like command line for Windows and it runs bash (and some other shells too), so no need for relearning. However you''d still have to install something.

Is there a way around that? Maybe - with win-bash for example, which is a port of an old version of bash. You don''t have to install it, just copy the exe somewhere. If you want to load it from the windows command line, put the place that exe is in in the Path variable. I''ve never tested it, but it sounds good, right?

There are similar projects like GNU BASH For Windows, GNU utilities for Win32, MinGW and probably many more. I don''t know which of these have to be installed and which don''t, but maybe you can tell us more soon? ^^

Oh, maybe just downloading wget for Windows will do the job too - it all depends on the script you want to write.

我正在看10行'nix中的代码,我现在就完成了。人们想知道为什么我对Windows的态度感觉如此。
And I''m looking at 10 lines of code in ''nix and I''d be done right now. People wonder why I feel the way I do about Windows.



相信我,我能理解你的挫败感。由于我一直在使用Linux,每次使用Windows机器时都感觉非常有限。


问候,

Nepomuk

Believe me, I can understand your frustration. Since I''ve been using Linux, I feel very limited every time I use a Windows machine.

Greetings,
Nepomuk


这篇关于抓取网页的脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆