-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfunctions.php
64 lines (55 loc) · 1.3 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
require 'vendor/autoload.php';
use Twilio\Rest\Client;
//if you don't have a twilio account, sign up using my referral link:
// https://www.twilio.com/referral/pnDYsm
//keep these keys private
$sid = "xxx";
$token = "xxx";
$twilioPhone = "xxx";
if (!function_exists("sendSMS")) {
//if you don't specify a from number, it will use the default twilio number
function sendSMS($message, $to, $from = "")
{
global $sid, $token, $twilioPhone;
$response = [];
if ($from == "") {
$from = $twilioPhone;
}
$client = new Client($sid, $token);
try {
$client->messages->create(
$to,
array(
'from' => $from,
'body' => $message,
)
);
$response['success'] = true;
$status = "Success";
$response['message'] = $status;
} catch (\Exception $e) {
$status = "Failed:" . $e->getMessage();
$response['success'] = false;
$response['message'] = $status;
}
return $response;
}
}
//preformatted var_dump function
if (!function_exists('dump')) {
function dump($var, $adminOnly = false, $localhostOnly = false)
{
echo '<pre>';
var_dump($var);
echo '</pre>';
}
}
//preformatted dump and die function
if (!function_exists('dnd')) {
function dnd($var)
{
dump($var);
die();
}
}