Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sending SMS from my php website script

    Good day programmers, please I'm a novice in coding and I need help with a script where people can send invitation message to their friend on my site as sms. I want users on my site to just drop the phone number of their friends only in the html form and it automatically sends the message I have configured to the number the member placed in the form. I'm hosted with hostgator, though I'm in nigeria, I run SMF 2.0.1 forum on my site, my targeted members are nigerians too. I have sms gateway with bbnsms.com, please guyz I need the script and html form for only phone number field(No message Field) as I want to send the same message that I already compose to all the phone numbers. Thanks guyz.

  • #2
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    SMS Examples

    Sending single text message

    Code:
    http://DomainName/bulksms/bulksms.php?username=xxxx&password=xxxxx&messa
    ge=xxxxxx&mobile=9999999999&sender=xxxxxxx
    For example the completed URL is:
    Code:
    http://www.bbnsms.com/bulksms/bulksms.php?username=drogba@bbnsms.com&passwo
    rd=mypasswd&message=TestMessage&mobile=238088888888&sender=Fumi

    Sending Multiple text message
    Code: [Select]

    Code:
    http://DomainName/bulksms/bulksms.php?username=xxxx&password=xxxxx&messa
    ge=xxxxxx&mobile=238088888888, 238088888888, 238088888888, 238088888888,
    238088888888&sender=xxxxxxx

    The above Url is the basic HTTP BULK link structure where the details about each
    parameter is given below:

    For example the completed URL is:
    Code: [Select]

    Code:
    http://www.bbnsms.com/bulksms/bulksms.php?username=drogba@bbnsms.com&passwo
    rd=mypasswd&message=TestMessage&mobile=238088888888, 238088888888,
    238088888888, 238088888888, 238088888888&sender=Kemi


    Thats d format of how my sms gateway works with example.

  • #3
    New Coder
    Join Date
    Sep 2011
    Posts
    80
    Thanks
    0
    Thanked 13 Times in 12 Posts
    Have you started/made any progress with this script so far?

  • #4
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yo can use ajax
    Code:
    <script type="text/javascript"><!--
    function ajaxRequest(){
     var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE
     if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
      for (var i=0; i<activexmodes.length; i++){
       try{
        return new ActiveXObject(activexmodes[i])
       }
       catch(e){
        //suppress error
       }
      }
     }
     else if (window.XMLHttpRequest) // if Mozilla, Safari etc
      return new XMLHttpRequest()
     else
      return false
    }
    
    var mygetrequest=new ajaxRequest()
    mygetrequest.onreadystatechange=function(){
     if (mygetrequest.readyState==4){
      if (mygetrequest.status==200 || window.location.href.indexOf("http")==-1){
       document.getElementById("result").innerHTML=mygetrequest.responseText
      }
      else{
       alert("An error has occured making the request")
      }
     }
    }
    var mobilevalue=encodeURIComponent(document.getElementById("mobile").value)
    var textvalue=encodeURIComponent(document.getElementById("message").value)
    mygetrequest.open("GET", "http://www.bbnsms.com/bulksms/bulksms.php?username=drogba@bbnsms.com&passwo
    rd=mypasswd&message="+textvalue+"&mobile="+mobilevalue+"&sender=Kemi", true)
    mygetrequest.send(null)
    --></script>
    i was given dat on a site bt i dont know what to do next as i dont have programing idea

  • #5
    New to the CF scene
    Join Date
    Jan 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    I think you can get any script from here: ozekisms.com
    But i insert a code here tno show how to send sms using PHP script.

    Code:
    <?php
    
    ########################################################
    # Login information for the SMS Gateway
    ########################################################
    
    $ozeki_user = "admin";
    $ozeki_password = "abc123";
    $ozeki_url = "http://127.0.0.1:9501/api?";
    
    ########################################################
    # Functions used to send the SMS message
    ########################################################
    function httpRequest($url){
        $pattern = "/http...([0-9a-zA-Z-.]*).([0-9]*).(.*)/";
        preg_match($pattern,$url,$args);
        $in = "";
        $fp = fsockopen("$args[1]", $args[2], $errno, $errstr, 30);
        if (!$fp) {
           return("$errstr ($errno)");
        } else {
            $out = "GET /$args[3] HTTP/1.1\r\n";
            $out .= "Host: $args[1]:$args[2]\r\n";
            $out .= "User-agent: Ozeki PHP client\r\n";
            $out .= "Accept: */*\r\n";
            $out .= "Connection: Close\r\n\r\n";
    
            fwrite($fp, $out);
            while (!feof($fp)) {
               $in.=fgets($fp, 128);
            }
        }
        fclose($fp);
        return($in);
    }
    
    
    
    function ozekiSend($phone, $msg, $debug=false){
          global $ozeki_user,$ozeki_password,$ozeki_url;
    
          $url = 'username='.$ozeki_user;
          $url.= '&password='.$ozeki_password;
          $url.= '&action=sendmessage';
          $url.= '&messagetype=SMS:TEXT';
          $url.= '&recipient='.urlencode($phone);
          $url.= '&messagedata='.urlencode($msg);
    
          $urltouse =  $ozeki_url.$url;
          if ($debug) { echo "Request: <br>$urltouse<br><br>"; }
    
          //Open the URL to send the message
          $response = httpRequest($urltouse);
          if ($debug) {
               echo "Response: <br><pre>".
               str_replace(array("<",">"),array("&lt;","&gt;"),$response).
               "</pre><br>"; }
    
          return($response);
    }
    
    ########################################################
    # GET data from sendsms.html
    ########################################################
    
    $phonenum = $_POST['recipient'];
    $message = $_POST['message'];
    $debug = true;
    
    ozekiSend($phonenum,$message,$debug);
    
    ?>
    I hope it helps.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •