-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsms.php
More file actions
36 lines (27 loc) · 1.07 KB
/
sms.php
File metadata and controls
36 lines (27 loc) · 1.07 KB
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
<?php
require __DIR__ . '/vendor/autoload.php';
use Twilio\Rest\Client;
$pedidoSMS = $_POST['pedido'];
$platosSMS = $_POST['platos'];
// Your Account SID and Auth Token from twilio.com/console
$account_sid = 'AC80f19b1d144821573e5ea80139343196';
$auth_token = '309fec38bae1c12282e0b9b95874f3d3';
// In production, these should be environment variables. E.g.:
// $auth_token = $_ENV["TWILIO_ACCOUNT_SID"]
// A Twilio number you own with SMS capabilities
$twilio_number = "+34911061996";
$mensaje = "Fast & Healthy\nYa puede recoger el pedido de '". $pedidoSMS[1] ."' que consta de:";
echo count($pedidoSMS);
for($i = 3; $i < count($pedidoSMS); $i++){
$mensaje .= "\n- " . $platosSMS[$pedidoSMS[$i]][1];
}
$mensaje .= "\n-- Calle del pokemon shiny, 6, 3ºB\nTeléfono de contacto: +34666676767\nHora de expedición: ".date('H:i');
$client = new Client($account_sid, $auth_token);
$client->messages->create(
// Where to send a text message (your cell phone?)
'+34610956815',
array(
'from' => $twilio_number,
'body' => $mensaje
)
);