Change Sender ID and select different service provider using PHP

Change Sender ID and select different service provider using PHP SearchSearch
Author Message
Vamsee Vanaparthy
New member
Username: Vamsee

Post Number: 2
Registered: 03-2006
Posted on Tuesday, June 20, 2006 - 09:56 am:   

Dear Support,

Iam really thankful for providing this amazing product for sending and receiving SMS through NOWSMS. I have everything setup now the Nowsms server works fine. We have 3 connections now with different service providers. I have a website programmed in php to send and recieve SMS.

I have 2 queries. I would be very glad if some one could help.

Query 1:

I use the following function to send SMS from my website. Most imoprtant thing is that The connectivity type with these service providers is SMPP.


<?php
function SendSMS ($host, $port, $username, $password, $phoneNoRecip, $msgText) {
$fp = fsockopen($host, $port, $errno, $errstr);
if (!$fp) {
echo "errno: $errno \n";
echo "errstr: $errstr\n";
return $result;
}

fwrite($fp, "GET /?Phone=" . rawurlencode($phoneNoRecip) . "&Text=" . rawurlencode($msgText) . " HTTP/1.0\n");
if ($username != "") {
$auth = $username . ":" . $password;
echo "auth: $auth\n";
$auth = base64_encode($auth);
echo "auth: $auth\n";
fwrite($fp, "Authorization: Basic " . $auth . "\n");
}
fwrite($fp, "\n");

$res = "";

while(!feof($fp)) {
$res .= fread($fp,1);
}
fclose($fp);

return $res;
}
?>

SendSMS("IP", PORT, "USERNAME", "PASSWORD", "SENDER", "MESSAGE");
This function works fine

But the problem is how can I change the sender ID on the fly with the help of the php code. To be more precise is there a possibility for me to send a parameter from this script to change sender ID to another number.
One more important question is whether I can change sender ID in to not only number but also name like (NOWSMS) etc with the code. Please clarify me on this if possible with the code that may be used.


Query 2:

As I have told you earlier that I have 3 different connections and there is routing logic behind each connection. But the problem is if the number starts with "99" it goes to CYTA and if the number starts with "96" it goes to areeba. The thrid connection is bulk which is also CYTA. So how do you think I will be having the routing logic for this, because even this number starts with "99". Can I have a parameter or variable that I can delcare to choose specific connection using PHP please clarify me on this also.

Thank you so much again,


Regards,
Vamsee Vanaparthy
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 6094
Registered: 10-2002
Posted on Tuesday, June 20, 2006 - 04:55 pm:   

Hi,

1. You could edit the script to add a sender parameter.

For example, change function declaration like this:

function SendSMS ($host, $port, $username, $password, $sender, $phoneNoRecip, $msgText)

And change the line that builds the HTTP URL to also include the sender:

fwrite($fp, "GET /?Phone=" . rawurlencode($phoneNoRecip) . "&Text=" . rawurlencode($msgText) . "&Sender=" . rawurlencode($sender) . " HTTP/1.0\n");

2. It is possible to define routes so that you can then indicate that a message is to be sent via a specific route.

This is described in the following thread:

http://support.nowsms.com/discus/messages/1/11908.html

There is no need to download the update referenced in that thread. Support for the "SMSCRoute" parameter is standard in NowSMS 2006.

Similar to the edit above, you could edit the script to add an "SMSCRoute" parameter. Just leave that parameter blank when you want default routing to apply. Set it when you want to force the message to go through a particular route.

-bn
Andrea Ambu
New member
Username: 3n1gm4

Post Number: 1
Registered: 06-2006
Posted on Thursday, June 29, 2006 - 10:04 pm:   

I tried to change change the sender ID and modified the php code but it DOES NOT work...

Where can i change that in the program? is it possible?
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 6134
Registered: 10-2002
Posted on Thursday, June 29, 2006 - 11:07 pm:   

What doesn't work?

I'm sorry, but you need to provide more details.

Please note that if you are using a GSM modem as your SMSC connection, it is NOT technically possible to change the sender address.

-bn
Andrea Ambu
New member
Username: 3n1gm4

Post Number: 2
Registered: 06-2006
Posted on Friday, June 30, 2006 - 12:17 pm:   

> What doesn't work?

I can't change sender id

>I'm sorry, but you need to provide more details.
>Please note that if you are using a GSM modem as your SMSC connection, it is NOT technically possible to change the sender address.

I'm using my cell phone as SMSC and I didn't know i cannot change sender ID in this way.

So what I need to change it?

Thanks, Andrea
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 6153
Registered: 10-2002
Posted on Monday, July 03, 2006 - 03:42 pm:   

Hi Andrea,

In order to change the sender id, you need to be connected to an SMS service provider that supports this capability.

The connection needs to be via one of the other protocols, such as SMPP, UCP/EMI, CIMD or HTTP ... NOT a GSM modem. And the service provider needs to support this capability, so you need to query the SMS service provider to determine what values they will support for the sender address. (Some will allow you to specify any phone number ... some will allow you to use text/alphanumeric values ... some a combination.)

-bn
Andrea Ambu
New member
Username: 3n1gm4

Post Number: 3
Registered: 06-2006
Posted on Monday, July 03, 2006 - 08:12 pm:   

I see. My intention is to send SMS by my operator but changing sender id but you say that's impossible to do it with a GSM modem... Can you hint me where to find a "low cost" service that can do it? (I need to send SMS in Italy :-)

Anyway thank you very much.

Regards, Andrea
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 6163
Registered: 10-2002
Posted on Thursday, July 06, 2006 - 07:21 pm:   

Andrea,

It's a difficult task to recommend any SMS service provider globally, especially when price is the leading concern.

In these situations, you are usually best off with a service provider that specialises in your country. But I don't have any suggestions for a particular provider.