I would like to schedule when I send sms messages using Twilio. I currently can schedule when to run php scripts using Windows Scheduler, however, whenever I try to send messages using twilio, the script doesn't execute.
PHP script that sends sms text message via using twilio
<?php
// Required if your environment does not handle autoloading
include '../vendor/autoload.php';
// Use the REST API Client to make requests to the Twilio REST API
use Twilio\Rest\Client;
// Your Account SID and Auth Token from twilio.com/console
$sid = 'XXXXXXXXXXXXXXXXXXXXXXXXX';
$token = 'XXXXXXXXXXXXXXXXXXXXXXXXXX';
$client = new Client($sid, $token);
// Use the client to do fun stuff like send text messages!
$client->messages->create(
// the number you'd like to send the message to
'+19894837813',
array(
// A Twilio phone number you purchased at twilio.com/console
'from' => '+19823837823',
// the body of the text message you'd like to send
'body' => 'Hey Jenny! Good luck on the bar exam!'
)
);
?>
VB script that references batch file
Set WinScriptHost = CreateObject("WScript.Shell")
WinScriptHost.Run Chr(34) & "C:\xampp\htdocs\Twilio\php\script.bat" & Chr(34), 0
Set WinScriptHost = Nothing
Batch file that calles php script
"C:\xampp\php\php.exe" -f "C:\xampp\htdocs\Twilio\php\index.php"