检查自上次以来网址中的数据是否发生了变化? [英] Check if data from a url has changed since last time?

查看:177
本文介绍了检查自上次以来网址中的数据是否发生了变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于给定的网址,我想检查自上次以来内容是否已更改。 (http)URL的内容由脚本生成,该脚本定期进行多次修改。需要查看此脚本更改是否导致任何回归。

For a given URL, I want to check if the content has changed since the last time. The content for the (http) URL is generated by a script which goes through several modifications regularly. Need to see if there are any regressions caused by this changing of the script.

Prac

推荐答案

除非知道您使用的语言,最简单的解决方案是使用 If-Modified-Since HTTP标头格式化您的请求并检查来自服务器的 304 (未修改)响应。如果内容是脚本生成的静态文件,那么您的Web服务器将检查文件上修改的时间戳。您将获得304响应,或者使用新内容页面获得200(OK)响应。

Barring knowing what language you're using, the simplest solution is to format your request using the If-Modified-Since HTTP header and check for a 304 (not modified) response from your server. If the content is a static file generated by a script, then your webserver will check against the modified timestamp on the file. You'll either get a 304 response, or a 200 (OK) response with the new content page.

这篇关于检查自上次以来网址中的数据是否发生了变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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