Jump to content
Fórum Script Brasil
  • 0

Pedido de Ajuda (enviar SMS)


mandarim
 Share

Question

Boa Tarde...

Venho pedir ajuda aos carolas desta casa, pretendo enviar emails a partir do pc utlizando um formulario php.

Tenho algo assim mas não estou a conseguir o envio.

alguém me poder ajudar ?

 

Link para o manual do sms express

 

http://minhateca.com.br/mandarim/Literatura/Manual+Webservices+SMS+Express+-+v5.6,901730000.pdf

Abraço e Obrigado

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHP SMS script</title>
<meta name="description" content="Envio de SMS utilizando a API da Meo">
<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:; margin:; padding:;}
.spacer{clear:both; height:1px;}
/* ----------- My Form ----------- */
.myform{
margin: auto;
width:250px;
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(,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==) {
nalt.innerHTML="<font size=1 > Enter Numbers</font>";
         document.myform.to.focus();;
return false;
}
}
</script>

</head>
<body>
<?php

$username = "xxxxxxx";
$password = "xxxxxxx";
$from = "PE1800";

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

switch ($option) {case sendsms:
if ($text == "") { echo
"<center><br>Erro!<br><b>não escreveu a mensagem<b><br><a href=\"javascript:history.back(-1)\"><b>Voltar<b></a><br></center>";
die; } else { }

if ($to == "") { echo "<center><br>Erro!<br><b>não escreveu a mensagem<b><br><a href=\"javascript:history.back(-1)\"><b>Voltar<b></a><br></center>";
die; } else { }

$url = "https://smsexpress.cloud.ptempresas.pt/webservices-smsexpress/SubmissionManager2";$postfields = array(
'username' => "$username",
'password' => "$password",
'route' => "$route",
'from' => "$from",
'to' => "$to",
'text' => "$text"
);
if (!$curld = curl_init()) {
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);

$created = date('Y-m-d H:i:s');

$result = explode(';',$output);
if ($result[] == "Error") {
echo <br><br><a href=\"smser_multi.php\" ><b>Go Back</b></a></center>";} else {
echo "<center>Data: $created <br>";
echo "Para: $to <br>";
echo "Mensagem ID: $result[1] <br>";
echo "Mensagem Status: $result[] <br>";
echo "<br><a href=\"smser.php\"><b>Enviar nova Mensagem</b></a></center>";
}

break;
default:

echo

"<div id=\"stylized\" class=\"myform\">"
."Envio de Sms utilizando o Gateway da meo"
."<form name=\"myform\" method=post action=\"$PHP_SELF?option=sendsms\">"
."<table border=\"\">"
."<tr>"
."<td>Numero</td>"
."<td><input style=\"border: 1px solid #523f6d;width:85%;height:30px;\" maxlength=17 placeholder=\" xxxxxxxxx\" type=\"text\" size=26 name=\"to\" id=\"to\" onkeyup=\"isNumeric()\"><span id=phno1></span></td>"
."</tr>"
."<tr>"
."<td>Mensagem</td>"
."<td><textarea style=\"resize: none;width:85%;border: 1px solid #523f6d;outline:none;\" name=text wrap=physical rows=4 cols=25 onkeyup=limiter()></textarea></td><br>"
         ."</tr>"
."<tr>"
."<td></td>"
         ."<td>Carateres permitidos: <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 style=\"width:8em;font-size:10px;\" type=submit name=submit value=Enviar>"
."<div class=\"spacer\"></div></td>"
."</tr>"
."</table>"
."</form>"
."</div><br>";
}

?>
</center>
</body>
</html>

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      149.9k
    • Total Posts
      646.8k
×
×
  • Create New...