sms message via php

Discussion in 'PHP' started by Sasikumar, Mar 18, 2008.

  1. #1
    Hi

    any want got idea's on how to send an sms message via php......
    without going through a gateway and paying for a service...

    Thanks
     
    Sasikumar, Mar 18, 2008 IP
  2. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,277
    Likes Received:
    33
    Best Answers:
    7
    Trophy Points:
    150
    #2
    That's something I am also interested in. So if anyone has any info let us PLEASE know.
     
    stephan2307, Mar 20, 2008 IP
  3. azlanhussain

    azlanhussain Active Member

    Messages:
    640
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #3
    I don't know about PHP but with Perl or C I defenitely know. But must run with linux.

    I used to run my own SMS gateway with Telcos in Malaysia, Bangladesh, India, Indonesia and Nepal. But already sold off the whole business. All technical development were done by me.

    If you need to develop any SMS service either free or paid, I might be able to help. If you're interested, you can always PM me.

    Cheers,
     
    azlanhussain, May 29, 2008 IP
  4. suresh2220

    suresh2220 Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I don't think its possbile , You need to signup to some SMS Gateway provider. you can't able to do it from own


    with regards,
    A Suresh Kumar
    http://suresh-mobileweb.blogspot.com
     
    suresh2220, May 30, 2008 IP
  5. Tomastamm

    Tomastamm Well-Known Member

    Messages:
    448
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    110
    #5
    Sms Gateway, High Quality, Delivery Reports, Free Trial, Easy setup and usage. Send and Receive SMS. http://www.2-waysms.com
     
    Tomastamm, Mar 3, 2010 IP
  6. alexus

    alexus Well-Known Member

    Messages:
    746
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    110
    #6
    most of providers will let you email to phone that act as sms, but draw back you need to know who's provider before sending it ...
     
    alexus, Mar 3, 2010 IP
  7. Narrator

    Narrator Active Member

    Messages:
    392
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    80
    #7
    If you have a google voice account, you can use it to send sms
    
    //Google Voice FOR Sending SMS
    // Google Account Info
    define('GOOGLE_ACCOUNT','YourAccountName');
    define('GOOGLE_PASSWORD','YourPassword');
    
    function query($data=array(),$fields=array()){
           foreach($data as $k=>$v)
                   $fields[]=$k.'='.urlencode(stripslashes($v));
           return implode('&',$fields);
    }
    function googleapi($url,$post=null,$headers=null){
           $ch=curl_init();
           curl_setopt($ch,CURLOPT_URL,$url);
           if(is_array($post)){
                   curl_setopt($ch,CURLOPT_POST,true);
                   curl_setopt($ch,CURLOPT_POSTFIELDS,query($post));
           }
           if(is_array($headers))
                   curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
           curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
           curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,2);
           curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
           $data=curl_exec($ch) or curl_error($ch);
           curl_close($ch);
           return $data;
    }
    
    
    $auth=googleapi('https://www.google.com/accounts/ClientLogin',array(
                                                   'accountType'=>'GOOGLE',
                                                   'Email'=>GOOGLE_ACCOUNT,
                                                   'Passwd'=>GOOGLE_PASSWORD,
                                                   'service'=>'grandcentral',
                                                   'source'=>'SendSMS'));
    if(preg_match('/Error=([A-z]+)/',$auth,$error))
           die($error[1]);
    if(preg_match('/Auth=([A-z0-9_-]+)/',$auth,$auth));
           $auth=$auth[1];
    preg_match("/'_rnr_se'\: '([^']+)'/",googleapi('https://www.google.com/voice/?auth='.$auth),$rnr);
    $rnr=$rnr[1];
    
    
    function sms($them,$text){
           global $auth,$rnr;
           return googleapi('https://www.google.com/voice/sms/send/?auth='.$auth,array(
                   'id'=>'',
                   'phoneNumber'=>$them,
                   'text'=>$text,
                   '_rnr_se'=>$rnr)
           );
    }
    
    PHP:
    (Code from http://www.ryanbyrd.net/techramble/2009/10/28/accessing-google-voice-text-messages-through-php/)

    Google voice is currently invite only, but you can buy an invite on ebay for a $1
     
    Narrator, Mar 3, 2010 IP
  8. HivelocityDD

    HivelocityDD Peon

    Messages:
    179
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I think you can make use of Kannel its an opensource sms gateway script. Will be needing a linux box though
     
    HivelocityDD, Mar 4, 2010 IP
  9. rajaweb

    rajaweb Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I try that script but it doesn't work.

    help me please..
     
    rajaweb, May 20, 2010 IP
  10. jaholden

    jaholden Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    You will need an account at a messaging provider, such as clickatell.com. Once you have that, and purchased credits for it, you will be able to send SMS messages using their API.

    There are usually several APIs, including HTTP, email, and SMPP (for which you'll need an SMPP client such as Kannel).

    There are also some gotchas around sending to certain countries due to local restrictions. You are almost always best off using a gateway company in the country you intend on sending the most messages to. Query the provider with regard to their "reach" (geographical coverage) before you sign up.

    There's another option though, which involves using a GSM modem (a 3g USB stick will work) and a regular SIM card. You can use and open-source SMS program called smsd to send the messages to it via the serial port (eg: /dev/ttyUSB0). I wouldn't personally recommend this method though, as the throughput is low and it can be unreliable due to being susceptible to phone network problems.
     
    jaholden, May 20, 2010 IP
  11. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #11
    roopajyothi, May 20, 2010 IP
  12. yogi007

    yogi007 Peon

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    It's a tough task. I tried many times and failed. better you sent SMS through mobile itself.....
     
    yogi007, May 20, 2010 IP
  13. jaholden

    jaholden Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Well, once you have an account with a messaging provider, you just need to use the code samples they all provide!

    There's free options, but they're all unreliable and frankly crap.
     
    jaholden, May 20, 2010 IP