PHP uses monitoring Polaris to perform WHMCS automatic tasks

Source: Internet
Author: User
Tags whmcs
Well, it's actually a Linux project, but ... Not-_-

Think of, you can take advantage of the timing of the monitoring of the characteristics of the visit, to perform Whmcs scheduled tasks.

However, the tangled place is coming ... Monitoring treasure the longest monitoring interval is 1 hours ...

So, this code is born ...

First, the analysis, if the monitoring treasure every 1 hours to access the specified URL, this requires a counter, and because the memory can not be resident, write SQL Trouble, so, the use of file storage.

24 hours a day, the monitoring treasure will visit 24 times, but the monitoring treasure will have two nodes simultaneously access, so 24*2=48.

Not familiar with PHP, so the concurrency problem is not considered here. Because of the file operations involved, it is not possible to have no permissions

Release the Code:

 =48) {//monitor treasure has two nodes simultaneous access, so this is not a 24-hour foreach ($urls as $key = $value) {File_g            Et_contents ($value);        } $count = 0;        } echo "$count";        DeleteFile ($fileName);    CreateFile ($fileName, $count);        }//Create File function CreateFile ($fileName, $value) {$fp = fopen ($fileName, "w+");        Fwrite ($fp, $value);    Fclose ($FP);    }//delete file function DeleteFile ($fileName) {@unlink ($fileName); }?>

Test it or it works. * ^^ *

Finally, how can I tell you that. The cloud products such as Bae and the DA,CP panel are all cron-supported.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.