PHP Bulk Send SMS or email scheme

Source: Internet
Author: User
Tags message queue rabbitmq

Recently encountered in the development of a scene, the Background administrator batch audit users, need to send users to audit through information, some people may think of using a foreach loop to send, the general SMS interface has a call frequency, loop send, will certainly lead to some of the information sent to fail, some people say with sleep () Sleep for a while, this also can not, if encountered the user more situation will certainly lead to PHP execution timeout, landlord reference online solution, there are 2 kinds of solutions, the first is to use the queue, more commonly used has RABBITMQ, this one cross-multilingual message queue implementation, the function is very powerful, specifically can Baidu, because this scene is small , not to use RABBITMQ, there is a solution, is to use the Linux task plan, Crond,

1, in Linux Crond is managed by crontab, enter CRONTAB-E in the terminal can create a new task, the format of the task is: * * * * * [executed script]

2, each * number represents the time of day and Moon week, for example, I need not half an hour to perform an operation: */30 * * * * Curl/Domain name/controller/operation, can also be specified in range: 0,30 7-22 * * * Curl/Domain name/controller/operation Represents every half-hour between 7 and 10.

3, the first time the audit user ID into a queue table, the table has the user's corresponding phone number,

4, then write a send operation, remove 5 at a time,

5, then open a timing plan to perform this operation, after the new task, service Crond Restart Restart plan, then service Crond status can see the task is running,

Note: The new process is the VI command operation, after the new WQ must be saved

PHP Bulk Send SMS or email scheme

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.