通过 cronjob 发送 action=updatenow 到服务器?
我是一个网站的会员,每次我访问该网站时,当我按下更新按钮时,都会收集游戏的统计数据。我希望这种情况每天自动发生一次,我被告知这应该可以通过 cronjob...
该页面是: http://bfbc2.statsverse.com/stats/ps3/ChiefOfVikings/
棘手的部分是,更新是由 javascript 触发的..但据我所知, javascript 只是这样:(
$.ajax(
{
type:"POST",
data: { action: "updatenow" },
})
}
虽然不确定)
任何人都可以帮我找到通过 cronjob 每天自动触发一次更新的任何方法吗?
I am a member of a site, where stats from a game is collected every time I visit the site, when I press the update button.. I would like this to happen once a day automatically, and I've been told that this should be possible through a cronjob...
the page is : http://bfbc2.statsverse.com/stats/ps3/ChiefOfVikings/
the tricky part is, that the update is triggered by a javascript.. but as far as I can tell, the javascript is only this:
$.ajax(
{
type:"POST",
data: { action: "updatenow" },
})
}
(not sure though)
Can anyone help me find any way of the update being triggered automatically once a day through a cronjob?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 curl 来完成此操作。 Curl 允许您构造 url GET 和 POST 来模仿浏览器操作(也支持其他 HTTP 类型)。您可以通过执行类似以下操作来使curl正常工作:
选项为
-L
=遵循重定向(HTTP 301或302)-i
=包括从服务器返回的HTTP标头在输出中-v
= 详细-c
sitecookie.txt = 将 cookies 写入 sitecookie.txt-b
sitecookie.txt = 从 sitecookie 读取 cookies .txt 向 url 发送数据时-d action=updatenow
= HTTP POST action=updatenow 到 URL如果服务器是 HTTPS 加密的,您可能还需要
-k
。有关更多选项和文档,请参阅 curl 手册页。最后要注意的一件事是,您发布的 url 必须是 ajax 发送到的 url。
一旦您从命令行开始工作,请将其放入脚本中,然后每天从 cronjob 运行该脚本。
You can do this with curl. Curl allows you to construct url GETs and POST to mimic a browser action (other HTTP types are also supported). You could get curl working by doing something similar to:
The options are
-L
= follow redirects (HTTP 301 or 302)-i
= include the HTTP header returned from the server in the output-v
= verbose-c
sitecookie.txt = write cookies to sitecookie.txt-b
sitecookie.txt = read cookies from sitecookie.txt when sending data to the url-d action=updatenow
= HTTP POST action=updatenow to the urlYou may also need
-k
if the server is HTTPS encrypted. See the curl manpage for more options and documenation.One final thing to note, the url you POST to must be the one that the ajax is sending to.
Once you have this working from the command line, put it in a script then run the script from a cronjob every day.