[Asteriskbrasil-biz] [AsteriskBrasil] CHAN_DONGLE - SMS VIA WEB

Leomar Soares de Almeida leomarsa em gmail.com
Quarta Dezembro 11 22:20:06 BRST 2013


Boa noite galera.


Alguém consegue fazer envia de SMS por chan_dongle.


segue script php com modelo de pagina.

pagina smser.php

<?
/*
 Simple and easy for modification, PHP script for SMS sending through HTTP
with you own Sender ID and delivery reports.
 You just have to type your account information on www.2-waysms.com and
upload file on server.

 Istruction:

 // Find 2 parameters in <body> and type your account information on
www.2-waysms.com

 1.  $from = "********"; // Change ********, and put your SMS Number in
www.2-waysms.com account
 2.  $token = "********"; // Change ********, and put your token code in
www.2-waysms.com account

*/
?>

<html>
<head>
<meta name="robots" content="index">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sistema de Envio de SMS com Chan_dongle</title>
<style type="text/css">
body{
font-family:"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial,
Helvetica, sans-serif;
font-size:12px;
}
p, h1, form, button{border:0; margin:0; padding:0;}
.spacer{clear:both; height:1px;}
/* ----------- My Form ----------- */
.myform{
margin:0 auto;
width:340px;
padding:14px;
}
/* ----------- stylized ----------- */
#stylized{
border:solid 2px #b7ddf2;
background:#ebf4fb;
}
#stylized h1 {
font-size:14px;
font-weight:bold;
margin-bottom:8px;
}
#stylized p{
font-size:11px;
color:#666666;
margin-bottom:20px;
border-bottom:solid 1px #b7ddf2;
padding-bottom:10px;
}
</style>
 <script type="text/javascript">
//Edit the counter/limiter value as your wish
var count = "160";   //Example: var count = "175";
function limiter(){
var tex = document.myform.text.value;
var len = tex.length;
if(len > count){
        tex = tex.substring(0,count);
        document.myform.text.value =tex;
        return false;
}
document.myform.limit.value = count-len;
}

// +,- delete
var r={'special':/[\W]/g}
function valid(o,w)
{
  o.value = o.value.replace(r[w],'');
}

// phone number checker
function isNumeric()
{
  var elem=document.myform.to.value;
  var nalt=document.getElementById('phno1');
 if(elem!="")
 {
    var numericExpression = /^[0-9]+$/;
  if(elem.match(numericExpression))
    {
         nalt.innerHTML="";
         return true;
       }

    else{
    nalt.innerHTML="<font size=1 > Numbers Only</font>";
  document.myform.to.focus();
   document.myform.to.value="";
       return false;
  }
  }
  else if(elem.length==0)  {
    nalt.innerHTML="<font size=1 > Ex. 6599...</font>";
     document.myform.to.focus();;
   return false;
    }
}
</script>
</head>
<body>
<?

$from = "********"; // Change ********, and put your SMS Number in
www.2-waysms.com account
$token = "********"; // Change ********, and put your token code in
www.2-waysms.com account


$option = $_REQUEST["option"];
$text = $_REQUEST["text"];
$to = $_REQUEST["to"];
$senderid = $_REQUEST["senderid"];


switch ($option) {

case sendsms:
if ($text == "") { echo
"<center><br>Erro!<br><b>Digite um texto para mensagem<b><br><a
href=\"javascript:history.back(-1)\"><b>Voltar<b></a><br></center>";
die; } else { }
 if ($to == "") { echo "<center><br>Error!<br><b>Number not
entered<b><br><a href=\"javascript:history.back(-1)\"><b>Go
Back<b></a><br></center>";
 die; } else { }

if ($senderid == "") { echo "<center><br>Error!<br><b>From not
entered<b><br><a href=\"javascript:history.back(-1)\"><b>Go
Back<b></a><br></center>";
die; } else { }

$url = "http://www.2-waysms.com/my/api/sms.php";

$postfields = array ("from" => "$from",
        "token" => "$token",
        "text" => "$text",
"to" => "$to",
"senderid" => "$senderid");
 if (!$curld = curl_init()) {
echo "Could not initialize cURL session.";
exit;
}
curl_setopt($curld, CURLOPT_POST, true);
curl_setopt($curld, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($curld, CURLOPT_URL, $url);
curl_setopt($curld, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($curld);
curl_close ($curld);
 $out = explode('|',$output);
echo "<center>Message Status: Sua mensagem foi enviado com sucesso para $to
$out[1]<br><a href=\"smser.php\"><b>Enviar nova
mensagem?</b></a></center>";

break;

default:
 echo
 "<div id=\"stylized\" class=\"myform\">"
   ."<form name=\"myform\" method=post action=\"$PHP_SELF?option=sendsms\">"
   ."<table border=\"0\">"
   ."<tr>"
   ."<center><h1>Envio de SMS com Chan_Dongle</h1></center>"
 ."<td>Remetente</td>"
 ."<td><input type=\"text\" name=\"senderid\"
onkeyup=\"valid(this,'special')\" onblur=\"valid(this,'special')\"></td>"
   ."</tr>"
   ."<tr>"
 ."<td>Destinatario</td>"
 ."<td><input type=\"text\" name=\"to\" id=\"to\"
onKeyup=\"isNumeric()\"><span id=phno1></span></td>"
   ."</tr>"
   ."<tr>"
 ."<td>Mensagem</td>"
 ."<td><textarea name=text wrap=physical rows=4 cols=25
onkeyup=limiter()></textarea></td><br>"
     ."</tr>"
   ."<tr>"
   ."<td></td>"
      ."<td>Caracter: <script type=\"text/javascript\">"
       ."document.write(\"<input type=text name=limit size=4 readonly
value=\"+count+\">\");"
       ."</script><br></td>"
   ."</tr>"
   ."<tr>"
 ."<td>&nbsp;</td>"
 ."<td><input type=submit name=submit value=Enviar>"
 ."<div class=\"spacer\"></div></td>"
   ."</tr>"
   ."</table>"
   ."</form>"
."</div><br>";
}
?>
</center>
</body>
</html>




-- 

==================================


*INNOVA INFORMÁTICA LTDA*LEOMAR SOARES DE ALMEIDA
Fixo:  (65) 3357-3357
Vivo.  (65) 9676-0062
E-mail: comercial em innovainformatica.net <leomarsa em gmail.com>
E-mail: leomarsa em gmail.com
Linkedin: http://lnkd.in/YMwxrW
Endereço: http://goo.gl/maps/2YfjW
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: http://listas.asteriskbrasil.org/pipermail/asteriskbrasil-biz/attachments/20131211/edcc2fa6/attachment-0003.htm 
-------------- Próxima Parte ----------
_______________________________________________
KHOMP: completa linha de placas externas FXO, FXS, GSM e E1
Media Gateways de 1 a 64 E1s para SIP com R2, ISDN e SS7
Intercomunicadores para acesso remoto via rede IP e telefones IP
Conheça todo o portfólio em www.Khomp.com
_______________________________________________
Para remover seu email desta lista, basta enviar um email em branco para asteriskbrasil-unsubscribe em listas.asteriskbrasil.org


Mais detalhes sobre a lista de discussão AsteriskBrasil-biz