定时抓取ACM竞赛rank信息

来源:互联网 发布:java旋转爱心代码 编辑:程序博客网 时间:2024/06/03 18:35

今天有ACM的比赛,学弟学妹们参加了。我想看他们比赛的情况,但是感觉自己一会儿切过去刷新下页面看一眼太麻烦,就写了个程序定时抓取排行榜信息,如果学弟学妹做出新的题目之后,就弹窗提示我,免得我一会儿切一下,太蠢了。

<?phpset_time_limit(0);$url = "http://board.acmicpc.info/ccpc2016/hdu_onsite.php";$solved = 0;while(1) {$content = file_get_contents($url);$regex = "/zzuli-3 \(A34\)<\/a><\/td><td>(\d)/";preg_match($regex, $content, $output);if ($output[1] != $solved) {$solved = $output[1];echo "<script>if(confirm('Solved new problem!')) {window.open(\"http://board.acmicpc.info/ccpc2016/hdu_onsite.php\");}</script>";}ob_flush();flush();sleep(30);}

悲伤的是,我代码写好之后,学弟学妹再也没有做出来过一道题……

0 0