可以刷新网站,直到用 Javascript 进行更改吗?
我是一个相对较新的编码员,在询问之前已经在此处和谷歌上进行了一些搜索,但我却一无所获。
我想知道是否有一种方法可以用 Javascript 创建脚本,并让它刷新页面,直到通过将页面输入到字符串中来更改页面。
类似的东西(请原谅那些糟糕的伪代码,但我意识到需要围绕此编写一些函数):
Start
currentPage = webclient.getPage("www.somesite.com")
boolean diff = false
string pageText = currentPage.astext()
do {
currentPage.refresh()
} until (currentPage.astext() != pageText)
string alert = "Change Found"
string address = "[email protected]"
e-mail(address,alert)
END
感谢任何人提供的任何帮助,任何人都可以为此提供新的编码器:)
I am a relatively new coder and have been searching around a bit on here and on google before asking but I have come up empty.
I was wondering if there was a way to create a script in say Javascript, and have it refresh a page until there is a change on the page by inputting the page into a string.
Something along the lines of (excuse the soddy psuedo-code but I realise that some functions would need to be written around this):
Start
currentPage = webclient.getPage("www.somesite.com")
boolean diff = false
string pageText = currentPage.astext()
do {
currentPage.refresh()
} until (currentPage.astext() != pageText)
string alert = "Change Found"
string address = "[email protected]"
e-mail(address,alert)
END
Thanks for any help anyone can offer a new coder on this :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PHP 似乎更适合这种操作。这是我要做的:
* 您不想像伪代码一样刷新页面,因为您的脚本会消耗大量带宽,并且很可能使您的目标网站饱和。
您需要代码示例吗?
编辑
这是我正在运行的 PHP 脚本:
有用的资源:
cURL 手册
邮件手册
希望你喜欢它;)
PHP seems better suited for this kind of operation. Here is what I would do:
* You don't want to refresh the page as much as your pseudo-code does, as your script would eat a lot of bandwidth and would be most likely to saturate your targeted website.
Do you need code samples ?
EDIT
Here's my working PHP script:
Helpful ressources:
cURL manual
mail manual
Hope you like it ;)