PHP uses the monitoring tool to execute automatic tasks of Whmcs

Source: Internet
Author: User
Tags whmcs
PHP uses the monitoring tool to execute automatic tasks of Whmcs. In fact, it is feasible to use Linux to schedule tasks,... No -_-

You can use the timed access feature of the monitoring site to execute the scheduled task of Whmcs.

However, the tangle is coming... The longest monitoring interval of the monitoring site is 1 hour...

So this code was born...

First, analyze it. if the monitoring site accesses the specified URL once every hour, a counter is required, and because it cannot be resident in memory, it is difficult to write SQL statements. so, use file storage.

24 hours a day, the monitoring site will visit 24 times, but the monitoring site will have two nodes to access at the same time, so 24x2 = 48.

I am not familiar with php, so I will not consider concurrency issues here. because file operations are involved, it is impossible to have no permissions.

Release code ..

 = 48) {// the monitoring site has two nodes for simultaneous access, so this is not a 24-hour foreach ($ urls as $ key = >$ value) {file_get_contents ($ value );} $ count = 0;} echo "$ count"; DeleteFile ($ fileName); CreateFile ($ fileName, $ count);} // create a file function CreateFile ($ fileName, $ value) {$ fp = fopen ($ fileName, "w +"); fwrite ($ fp, $ value); fclose ($ fp );} // delete the file function DeleteFile ($ fileName) {@ unlink ($ fileName) ;}?>

The test still works. * ^ *

Finally, how can we tell you that cloud products such as .. bae and da and cp panels support cron ..

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.