Tuesday, September 16, 2014

twilio - aggregated sms gateway

found the twilio when looking for freelancer.
initially, I thought that they provide attractive sms rate of 0.027 but only later found out that this is in US currency which converted to RM is close to 9sen / sms. Much higher than local content provider rate. Hence, the short code option is not viable through twilio.
Nevertheless,  please find the following method to test the twilio with their published REST API

Go to 54.254.53.88 (wkhtmltopdf server)
go to /var/tmp/twilio/twilio-php-master
edit test.php

install the twilio-php-master.zip
unzip in the PC and download (winscp) into the server (/var/tmp/twilio/twilio-php-master)
follow the sample code on the twilio website. 



require "/var/tmp/twilio/twilio-php-master/Services/Twilio.php";

// set your AccountSid and AuthToken from www.twilio.com/user/account
$AccountSid = "AC637853e1e1201472b91684dbcc88bd87";
$AuthToken = "a080c7872a6a0fe5dccd4784813ec34e";

$client = new Services_Twilio($AccountSid, $AuthToken);

//$message = $client->account->messages->create(array(
//    "From" => "66001",
//    "To" => "60123836313",
//    "Body" => "Test message!",
//));

// Display a confirmation message on the screen
//echo "Sent message {$message->sid}";


$sms = $client->account->messages->sendMessage(

        // Step 6: Change the 'From' number below to be a valid Twilio number
        // that you've purchased, or the (deprecated) Sandbox number
            "+1 717-454-2049",


            // the number we are sending to - Any phone number

.....

1 comment: