简体   繁体   English

如何使用PHP向100万条记录发送SMS或推送通知

[英]How to send SMS or Push Notifications to million records with PHP

I am new to this mobile technology and in PHP. 我是这种移动技术和PHP的新手。 I have about two or two and half records where I have to send SMSs as well as push notifications on the mobiles. 我大约有两到两个半记录,其中必须在手机上发送短信和推送通知。 With PHP, i have tried with simple looping technique, but it seems it is not the right way as some times SMSs are missed from the number. 使用PHP时,我尝试使用简单的循环技术,但是似乎不正确,因为有时会从号码中漏掉SMS。 Also, don't want to use third party APIs. 另外,不要使用第三方API。

I want to have some ideas how to deal this records with PHP script. 我想对如何使用PHP脚本处理此记录有一些想法。 here is the sudo code 这是sudo代码

$mobilenumbers = array("1","2","3",........."2500000");


foreach($mobilenumbers as $val){    
    $flag = $this->sendSms($val);
}

function sendSms($mobileNumber){

    Send SMS to Mobile Number

}

So, here foreach loop does many skips. 因此,这里的foreach循环会进行很多跳过。

I hope you know the basic code to send the notification to android and ios device by PHP. 我希望您知道通过PHP将通知发送到android和ios设备的基本代码。 you need to know only that how you can send it to multiple devices. 您只需要知道如何将其发送到多个设备即可。 It really took too much time if you sending it with PHP. 如果使用PHP发送,确实花费了太多时间。 Because for android each channel request must not have more than 1000 devices. 因为对于android,每个频道请求不得超过1000个设备。 and for IOS, you have to request for each device, it also provides support to send notifications to multiple devices at a time, but the possibilities of failure cases is higher than to send it for single. 对于IOS,您必须请求每个设备,它还提供了一次将通知发送到多个设备的支持,但是发生故障的可能性比发送单个通知要高。 if you want to send the notification to multiple devices at a time and one device id is wrong over there then it will close the channel for the remaining devices. 如果您想一次将通知发送到多个设备,并且一个设备ID在那里错误,则它将关闭其余设备的通道。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM