<tfoot id='hwlUo'></tfoot>

<small id='hwlUo'></small><noframes id='hwlUo'>

<legend id='hwlUo'><style id='hwlUo'><dir id='hwlUo'><q id='hwlUo'></q></dir></style></legend>
    <i id='hwlUo'><tr id='hwlUo'><dt id='hwlUo'><q id='hwlUo'><span id='hwlUo'><b id='hwlUo'><form id='hwlUo'><ins id='hwlUo'></ins><ul id='hwlUo'></ul><sub id='hwlUo'></sub></form><legend id='hwlUo'></legend><bdo id='hwlUo'><pre id='hwlUo'><center id='hwlUo'></center></pre></bdo></b><th id='hwlUo'></th></span></q></dt></tr></i><div id='hwlUo'><tfoot id='hwlUo'></tfoot><dl id='hwlUo'><fieldset id='hwlUo'></fieldset></dl></div>
    • <bdo id='hwlUo'></bdo><ul id='hwlUo'></ul>

      PHP - 远程文件更改时的电子邮件通知

      PHP - Email notification whenever a remote file changes(PHP - 远程文件更改时的电子邮件通知)

      <small id='skToI'></small><noframes id='skToI'>

        <tbody id='skToI'></tbody>

      <i id='skToI'><tr id='skToI'><dt id='skToI'><q id='skToI'><span id='skToI'><b id='skToI'><form id='skToI'><ins id='skToI'></ins><ul id='skToI'></ul><sub id='skToI'></sub></form><legend id='skToI'></legend><bdo id='skToI'><pre id='skToI'><center id='skToI'></center></pre></bdo></b><th id='skToI'></th></span></q></dt></tr></i><div id='skToI'><tfoot id='skToI'></tfoot><dl id='skToI'><fieldset id='skToI'></fieldset></dl></div>

      1. <legend id='skToI'><style id='skToI'><dir id='skToI'><q id='skToI'></q></dir></style></legend>
          • <bdo id='skToI'></bdo><ul id='skToI'></ul>
            <tfoot id='skToI'></tfoot>
                本文介绍了PHP - 远程文件更改时的电子邮件通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我想知道是否有办法让我的 Web 服务器上的 php 脚本在来自另一个 Web 服务器的文件发生更改时向我发送电子邮件.

                I was wondering if there's a way to have a php script on my web server email me whenever a file from another web server changes.

                例如,有一个经常变化的文件:http://media1.clubpenguin.com/play/en/web_service/game_configs/paper_items.json

                For instance, there's this file that changes frequently: http://media1.clubpenguin.com/play/en/web_service/game_configs/paper_items.json

                我写了一篇关于游戏的博客,该文件对于在我的竞争对手之前创建更新帖子非常重要.但我经常忘记检查它.

                I blog about a game and that file is very important for creating post on updates before my competitors. I often forget to check it though.

                有没有办法让脚本在文件更新时通过电子邮件发送给我,或者检查该文件以查看它是否已更新,如果有则通过电子邮件发送给我?

                Is there a way to have a script email me whenever that file updates, or check that file to see if it has updated, and email me if it has?

                推荐答案

                您需要将这两个文件放在同一个文件夹中.

                You need have this two files in same folder.

                • old.json
                • scriptForCron.php

                scriptForCron.php 中写:

                $url='http://media1.clubpenguin.com/play/en/web_service/game_configs/paper_items.json';
                $ch = curl_init($url);
                curl_setopt($ch,CURLOPT_CONNECTTIMEOUT, 5);
                curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
                $execute = curl_exec($ch);
                
                $fp=fopen('old.json','w+');
                $oldjson=fread($fp,filesize('old.json'));
                
                if($execute!=$oldjson){
                 mail('your@mail.com','Yoohoo', 'File changed');
                 fputs($fp,$execute);
                }
                fclose($fp);
                

                然后将 scriptForCron.php 添加到 cron 作业.您可以要求托管支持.

                And then add scriptForCron.php to cron job. You can ask hosting support for it.

                这篇关于PHP - 远程文件更改时的电子邮件通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Appending GET parameters to URL from lt;formgt; action(将 GET 参数附加到来自 lt;formgt; 的 URL行动)
                Forcing quot;Save Asquot; dialog via jQuery GET(强制“另存为通过 jQuery GET 对话框)
                PHP - get certain word from string(PHP - 从字符串中获取某个单词)
                How to debug a get request in php using curl(如何使用 curl 在 php 中调试 get 请求)
                get a # from a url in php(从 php 中的 url 获取 #)
                PHP - include() file not working when variables are put in url?(PHP - 将变量放入 url 时,include() 文件不起作用?)

                <small id='PWB8T'></small><noframes id='PWB8T'>

              • <legend id='PWB8T'><style id='PWB8T'><dir id='PWB8T'><q id='PWB8T'></q></dir></style></legend>
                    <bdo id='PWB8T'></bdo><ul id='PWB8T'></ul>
                    <tfoot id='PWB8T'></tfoot>

                  • <i id='PWB8T'><tr id='PWB8T'><dt id='PWB8T'><q id='PWB8T'><span id='PWB8T'><b id='PWB8T'><form id='PWB8T'><ins id='PWB8T'></ins><ul id='PWB8T'></ul><sub id='PWB8T'></sub></form><legend id='PWB8T'></legend><bdo id='PWB8T'><pre id='PWB8T'><center id='PWB8T'></center></pre></bdo></b><th id='PWB8T'></th></span></q></dt></tr></i><div id='PWB8T'><tfoot id='PWB8T'></tfoot><dl id='PWB8T'><fieldset id='PWB8T'></fieldset></dl></div>

                          <tbody id='PWB8T'></tbody>