Ask example send message php

Ask example send message php SearchSearch
Author Message
jrd
New member
Username: Arpori

Post Number: 1
Registered: 02-2009
Posted on Saturday, February 14, 2009 - 10:49 pm:   

Hi,
could someone give me example to send message to many number at once in php? please

thanks
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 470
Registered: 08-2008
Posted on Monday, February 16, 2009 - 04:43 pm:   

Hi,

Using the standard PHP script at the following link:

http://blog.nowsms.com/2008/10/nowsms-php-example-send-sms-text.html

... you can specify multiple recipients as a comma delimited list.

NowSMS doesn't have a limit to the number of recipients that it will support in such a list. However, there may be some limits in PHP itself. Most libraries will limit the length of a GET URL, often to around 2000 bytes, which severely limits the number of recipients you can specify. This particular PHP script does raw socket writes, so its limit should be significantly higher.

As an alternative to the comma delimited lists, you can build distribution lists in NowSMS. Then you send to the distrubtion list instead of a phone number.

The following link talks about building these distribution list files ... either as raw text files ... or using HTTP based APIs:

http://support.nowsms.com/discus/messages/485/20322.html

--
Des
NowSMS Support
jrd
New member
Username: Arpori

Post Number: 2
Registered: 02-2009
Posted on Tuesday, February 17, 2009 - 01:45 am:   

Hi,
can I create my own Dlist in my own aplication directory, not in nowsms server?

thanks
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 481
Registered: 08-2008
Posted on Tuesday, February 17, 2009 - 06:25 pm:   

No, the Dlist file needs to be accessible to the NowSMS server, and NowSMS only looks in a particular directory on the NowSMS server.

The alternative is a comma delimited list of numbers.

If you are concerned about the length exceeding HTTP GET URL lengths, then you can use HTTP POST instead. NowSMS also supports the standard POST variable format "application/x-www-form-urlencoded" where the GET variables are sent in a POST form instead of GET.

That said, if you're using our example PHP script, there shouldn't be an issue since we are doing raw socket i/o for the HTTP GET in that script.

It would be awkward to pass a large block of numbers to the script this way though.

If you don't want to put the distribution list file on the NowSMS server, I'd suggest reading through the list in your application, and submitting via the SendSMS function in groups of 100 or so.

--
Des
NowSMS Support