Exemplo n.º 1
0
<?php

error_reporting(E_ALL);
ob_implicit_flush(true);
include_once "class.curl.php";
include_once "class.sms.php";
include_once "cprint.php";
$smsapp = new sms();
$smsapp->setGateway('way2sms');
$myno = $_POST['fromno'];
$p = $_POST['pass'];
$tonum = $_POST['tono'];
$mess = $_POST['message'];
cprint("Logging in ..\n");
$ret = $smsapp->login($myno, $p);
if (!$ret) {
    cprint("Error Logging In");
    exit(1);
}
print "Logged in Successfully\n";
print "Sending SMS ..\n";
$ret = $smsapp->send($tonum, $mess);
if (!$ret) {
    print "Error in sending message";
    exit(1);
}
print "Message sent";
Exemplo n.º 2
0
<?php

error_reporting(E_ALL);
ob_implicit_flush(true);
//If you get Fatal error: Call to undefined function curl_init() , Then you need to enable the curl extension in php.ini
include_once "class.curl.php";
include_once "class.sms.php";
$smsapp = new sms();
$smsapp->setGateway('way2sms');
// you can set gateway to be '160by2' to use your 160by2 account;
echo "Logging in  ... ";
$smsapp->login('919891508595', '123456');
echo "Sending SMS ... ";
$result = $smsapp->send('918287769888', 'my message');
if ($result == 'true') {
    echo "Message sent";
} else {
    echo "Error encountered : " . $smsapp->getLastError();
}