Jump to content

Help: Sending SMS from my php website script


ayex2012

Recommended Posts

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.

heres a form

<html>
<body>
   <h1>My SMS form</h1>
   <form method=post action='sendsms.php'>
   <table border=0>
   <tr>
     <td>Recipient</td>
     <td><input type='text' name='recipient'></td>
   </tr>
   <tr>
     <td> </td>
     <td><input type=submit name=submit value=Send></td>
   </tr>
   </table>
   </form>
</body>
</html>

 

easiest way is to have it mail it for example

if you are wanting to send it to a verizon customer

send the mail to [email protected] it all depends on what you want to do, but without buying a sms gateway you are going to want to mail them

heres a form

<html>
<body>
   <h1>My SMS form</h1>
   <form method=post action='sendsms.php'>
   <table border=0>
   <tr>
     <td>Recipient</td>
     <td><input type='text' name='recipient'></td>
   </tr>
   <tr>
     <td> </td>
     <td><input type=submit name=submit value=Send></td>
   </tr>
   </table>
   </form>
</body>
</html>

 

easiest way is to have it mail it for example

if you are wanting to send it to a verizon customer

send the mail to [email protected] it all depends on what you want to do, but without buying a sms gateway you are going to want to mail them

 

 

Thanks for the quick response, I have sms gateway, but what I need is a script that will b sending the message as people put the phone number in the sms form

SMS Examples

 

Sending single text message

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

 

Sending Multiple text message

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:

http://www.bbnsms.com/bulksms/[email protected]&passwo
rd=mypasswd&message=TestMessage&mobile=238088888888, 238088888888,
238088888888, 238088888888, 238088888888&sender=Kemi

 

 

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

You can also use the skype API.

 

I hav my own sms gateway that i hav paid to. Thats their m

format above, if i type those samples above in browsers, with real details it will send sms just fine. Bt i need to script it so that my member on my site can b able to use it by just typing in the phon numbers in the form "chriscloyd" just gave me the code. Thanks gurus.

yo can use ajax

<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/[email protected]&passwo
rd=mypasswd&message="+textvalue+"&mobile="+mobilevalue+"&sender=Kemi", true)
mygetrequest.send(null)
--></script>

 

Question how will he be defining the message?

Thanx for d help chriscloyd plz i hav no php background, as what i want to ask maybe stupid, plz lets assume my message is Hi there, a friend of yours has invited you to join www.naijatechzone.com, do visit us soon. please how will put that in the code.

And most importantly how will i link this script with the html form??? will i create a "sendsms.php" and paste it in my file manager then paste this script and dats all??. Thanx for your time.

do a javascript command or ajax.

onwindows load do initpage function or something for example

<script type="javascript/text">
window.onload = pageChecker;

function pageChecker() {
    document.getElementById['submit'].onSubmit = do the function of sending the form with javascript
}
</script>

 

For the message you can put a hidden value in the form that sends the same message all the time

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.