How to submit a SMS?

Tips submitted by PHPMaker users
Post Reply
mpol_ch
User
Posts: 877
Location: Switzerland

How to submit a SMS?

Post by mpol_ch »

Hello
I realized to send SMSs with PHPMAKER 10.0.5 with easyvoip.com. This is a provider of betamax. You can create an account by one of them and send the SMS. Please keep in mind that you must have fully working web server installation. The solution is working on my side at ubuntu linux installation and not on xampp/win8. The below solutions will send a SMS on Row Inserted Event. You must adjust the username and password...

The source based on code from: hxxx://www.phpclasses.org/package/4501-PHP-Sen ... eways.html

Step 1:
Server Evets->Global->All Pages->Global Code
class betamaxsms{

public $provurl="www.easyvoip.com";
public $okresult="/<resultstring>success/";
public $username;
public $userphone;
public $userpassword;
public $destination;
public $text;
public $result;

function sendsms(){
$text=urlencode($this->text);

$build="hxxxs://".$this->provurl."/myaccount/sendsms.php?username=".$this->username."&password=".$this->userpassword."&from=".$this->userphone."&to=".$this->destination."&text=".$text;
//$build="hxxs://www.easyvoip.com/myaccount/sendsms.php? ... &text=This is content of my SMS";
$result=$this->engine($build);
if($result == 1){
$this->resultok();
}else{
$this->resultfail();
}
}
function engine($build){
$ch = curl_init($build);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 0);
$this->result = curl_exec($ch);
curl_close($ch);
return(preg_match ( $this->okresult , $this->result));
}


function resultok(){
echo "SMS mit dem Inhalt:\n\n";
echo urldecode($this->text);
echo "\n\n wurde verschickt an:\n\n";
echo $this->destination;
echo "\n\n";
echo "<br><a href='adressenlist.php'>Zurück</a>";
}

function resultfail(){
echo "Leider hat es nicht geklappt !!!\n\n";
echo "Fehlermeldung:\n";
echo $this->result;
echo "<br><a href='adressenlist.php'>Zurück</a>";
}
}

Step 2:
Server Events->Table-Specific->Common->Row_Inserted
// Row Inserted event
function Row_Inserted($rsold, &$rsnew) {

$sms=new betamaxsms();
$sms->username='USERNAME';
$sms->userpassword='PASSWORD';
$sms->userphone='+4178xxxxxxx';
$sms->destination=$rsnew["Ziel"];
$sms->text=$rsnew["Text"];
$sms->sendsms();
exit;
}

I hope it will help you.
mpol_ch


saleh
User
Posts: 470

Post by saleh »

If you want to send PIN to the Mobile User
How do I get it?

User table is

SELECT id, name, username, email, Level, thsos, moahel, sex, algassem, moder_algassem, id_alshaba, modeer_alshaba, maktm_tarbia, passwoord, Mobile, Activating FROM user1 WHERE 1


jrujano
User
Posts: 7

Post by jrujano »

I'm currently working on sending sms android smartphone that has installed the app sms gateway (Google Play) and call the sending message this way
$mensaje_sms='xxxxxxxxxxxx xxxxxxxxxx xxxxxx';
$mensaje_sms=str_replace(' ','%20',$mensaje_sms);

$url = 'http: //IP_SMSGATEWAY:9090/sendsms?phone=58xxx8218XXX&text='.$mensaje_sms;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);

Remeber install
php5-curl


Post Reply