Home  >  Article  >  php教程  >  利用监控宝来执行Whmcs的自动任务

利用监控宝来执行Whmcs的自动任务

PHP中文网
PHP中文网Original
2016-05-25 17:08:231537browse

利用监控宝来执行Whmcs的自动任务

<?php
    /*
    * By:  落落
    * To:  GetVM.Com
    * URL: www.MyLuoLuo.Com
    */
    set_time_limit(0);
    $fileName = "count.love";
    $urls = array("http://my.XXXX.net/cron.php"
        ,"http://billing.XXXX.com/cron.php");
    //如果文件不存在
    if(!file_exists($fileName))
    {
        CreateFile($fileName,0);
        exit();
    }
    if (!is_readable($fileName)) {
        //文件不存在或者无法读取
        die(&#39;File does not exist or could not be read!&#39;);
    }else
    {
        $count = file_get_contents($fileName);
        $count++;
        //监控宝有两个节点同时访问,所以这里不是24
        if($count>=48)
        {
            foreach ($urls as $key => $value) {
                file_get_contents($value);
            }
            $count=0;
        }
        echo"$count";
        DeleteFile($fileName);
        CreateFile($fileName,$count);
    }
 
    //创建文件
    function CreateFile($fileName,$value)
    {
        $fp = fopen($fileName, "w+");
        fwrite($fp, $value);
        fclose($fp);
    }
 
    //删除文件
    function DeleteFile($fileName)
    {
        @unlink($fileName);
    }
?>

 以上就是利用监控宝来执行Whmcs的自动任务的内容,更多相关内容请关注PHP中文网(www.php.cn)!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn