Bogomil Shopov

Human. Artist. Hacker. I care about free and open-source software(F/LOSS), cybersecurity, ethical design, privacy, and technology. 20+ experience in technology. 40+ in being human. I encourage people to become better humans with heavy metal and technologies. I also promote technologies to be considerate of humans. Let's see how it goes!

Open Technologies · July 30, 2010

Sending SMS messages via Twilio Rest API

I am looking at Twilio API right now for a project and I am surprised how easy is to handle voice and SMS messages. Here is an example, written by me:

ApiVersion = "2008-08-01";
	$this->AccountSid = "Axxxxxxxxxxxxxxxxxxxx"; //get your own after trial registration on
	$this->AuthToken = "axxxxxxxxxxxxxxxxxxxxx";
	$this->smsServer = new TwilioRestClient($this->AccountSid, $this->AuthToken);

function sendSMS($to, $from, $whattosend)

	$response = $this->smsServer->request("/$this->ApiVersion/Accounts/$this->AccountSid/SMS/Messages", 
			"POST", array(
			"To" => $to,
			"From" => $from,
			"Body" => $whattosend
			echo "Error: {$response->ErrorMessage}";
			echo "Done";


function __destruct()



$s= new Twillio_SMS;
$s->sendSMS('4155992671','4155992671','this is a test');


If you are interested in this topic, or if you have some ideas, please join me at my test repo @ Github