Welcome Guest, Not a member yet? Register   Sign In
How to send sms from php and code igniter
#1

[eluser]MASS MASS[/eluser]
Is it possible to send sms text message to phone using codeigniter framework or php code......


if Possible ...........give your suggestions......please


Its urgent...........

Thxs...in advance
#2

[eluser]ballen[/eluser]
You would need an SMS provider (such as http://www.2sms.com/ - they are in an office block close to me and hence come to mind), then there should be a way to tie into that (probably an XML web service) which of course PHP can be used to send data to.. I think that's right anyway.
#3

[eluser]CI jforth[/eluser]
do like google does select the carrier ie: t-mobile and add the number.
it works good for me. simple & easy.

send an email to [email protected]
#4

[eluser]tobben[/eluser]
Here is an example of a function that im using for talking to a SMS gateway api..

It's not CI-ified, but it would probably give you a taste.

The SMS gateway provider will probably also give you some technical info on how to connect and manage their API or whatever.

Code:
<?php
function SendSms($sender, $recipients, $message, $priceGroup, $flash)
{
    $CID = "xxx";
    $password = "xxxxx";
    
    if (!is_numeric($priceGroup) || !is_numeric($flash))
        return "priceGroup and flash must be a number";

    $serverRequest = "http://the.smsprovider.com/api.ext";
    $serverRequest .= "?CID=".$CID;
    $serverRequest .= "&Password;=".$password;
    if (is_numeric($sender))
        $serverRequest .= "&fromNumber;=".$sender;
    else
        $serverRequest .= "&fromAlpha;=".$sender;
    $serverRequest .= "&recipient;=".$recipients;
    $serverRequest .= "&Msg;=".urlencode($message);
    $serverRequest .= "&priceGroup;=".$priceGroup;
    $serverRequest .= "&flash;=".$flash;
    
    $serverResult = file_get_contents($serverRequest);
    
    if (!$serverResult)
         return "Returned error while trying to connect to gateway";

    $xml = simplexml_load_string($serverResult);
    
    if ($xml->success == "true")
        $result = $xml->msgid;
    else
        $result = $xml->errormsg;

    return $result;
}
?>
#5

[eluser]jairoh_[/eluser]
[quote author="CI jforth" date="1190726522"]do like google does select the carrier ie: t-mobile and add the number.
it works good for me. simple & easy.

send an email to [email protected][/quote]
why it doesn't work for me? Sad




Theme © iAndrew 2016 - Forum software by © MyBB