<?php

/**
 * Component for working with mPDF class.
 * mPDF has to be in the vendors directory.
 */
class TwilioComponent extends Component {

    public function sendmessage($message, $contact_no) {
        App::import('Vendor', 'Services/Twilio');
//        return true;
        // Step 2: set our AccountSid and AuthToken from www.twilio.com/user/account
        $AccountSid = "AC1b4db66d86197058950ad349a2327a85";
        $AuthToken = "053ae80d10eac3b60c92179d3492badf";

        // Step 3: instantiate a new Twilio Rest Client
        $client = new Services_Twilio($AccountSid, $AuthToken);

       $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
                "+61476856101",
                // the number we are sending to - Any phone number
                $contact_no,
                // the sms body
                $message
        );
       
        return $sms;

        // Display a confirmation message on the screen
    }

}
