<?php
    require __DIR__ . '/vendor/autoload.php';
    use Twilio\Rest\Client;
    
    // Your Account SID and Auth Token from twilio.com/console
    // To set up environmental variables, see http://twil.io/secure
    $account_sid = 'AC9a6d95862d239c1171eb772891e39bfd';
    $auth_token = 'eef4e312e34ca48a7953459792fe4acd';
    // In production, these should be environment variables. E.g.:
    // $auth_token = $_ENV["TWILIO_AUTH_TOKEN"]
    
    // A Twilio number you own with SMS capabilities
    $twilio_number = "+18643517156";
    
    // $client = new Client($account_sid, $auth_token);
    // $client->messages->create(
    //     // Where to send a text message (your cell phone?)
    //     '+61474224211',
    //     array(
    //         'from' => $twilio_number,
    //         'body' => 'Twilio test text message'
    //     )
    // );
    
    if(array_key_exists('sms_button', $_POST)) { 
        echo "something";
        
        $client = new Client($account_sid, $auth_token);
        echo $client;
        $client->messages->create(
            // Where to send a text message (your cell phone?)
            '+610474224211',
            array(
                'from' => $twilio_number,
                'body' => 'Twilio button finally works?22'
            )
        );
        echo "got to the bottom";
    }
    
    echo "
    <html>
    <body>
        <form method='post'>
            <input type='submit' name='sms_button'
                class='button' value='Click for sms' /> 
        </form>
    </body>
    </html>";

?>