-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpost.php
More file actions
32 lines (29 loc) · 885 Bytes
/
post.php
File metadata and controls
32 lines (29 loc) · 885 Bytes
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
<?php
/*
Wemo Web Controller
by Paul Loeb
@loebpaul
https://github.com/loebpaul/wemo-web-controller
I am not affiliated with WeMo or Belkin, Inc. in any way.
*/
require_once('config.php');
if (isset($_POST["name"])){
$name = $_POST["name"];
$url = "https://api.twilio.com/2010-04-01/Accounts/".TWILIO_ACCOUNT_SID."/SMS/Messages.json";
$fields = http_build_query(array(
"From" => TWILIO_PHONE_NUMBER,
"To" => IFTTT_PHONE_NUMBER,
"Body" => "#".$name
));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, TWILIO_ACCOUNT_SID.":".TWILIO_AUTH_TOKEN);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$result = curl_exec($ch);
curl_close($ch);
print_r($result);
}
?>