-
Notifications
You must be signed in to change notification settings - Fork 0
/
AnnoyingGirl.php
54 lines (44 loc) · 1.44 KB
/
AnnoyingGirl.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
<?php
// Webpage for replies from twilio.
$AccountSid = "";
$AuthToken = "";
$FolderPath = "http://www.example.com/twilio";
if (isset($_POST['Phone']) && isset($_POST['Text'])) {
if ($_POST['AccountSid'] == $AccountSid && $_POST['AuthToken'] == $AuthToken) {
$Open_Xml = fopen("twilio.xml", "w");
fwrite($Open_Xml, "<?xml version='1.0' encoding='utf-8' ?>\n");
fwrite($Open_Xml, "<Response>\n");
fwrite($Open_Xml, " <Say voice=\"woman\">\n");
fwrite($Open_Xml, " ".$_POST['Text']."\n");
fwrite($Open_Xml, " </Say>\n");
fwrite($Open_Xml, " <Hangup/>\n");
fwrite($Open_Xml, "</Response>");
fclose($Open_Xml);
/* Include the PHP TwilioRest library */
require "twilio.php";
/* Twilio REST API version */
$ApiVersion = "2008-08-01";
/* Instantiate a new Twilio Rest Client */
$client = new TwilioRestClient($_POST['AccountSid'], $_POST['AuthToken']);
/* Initiate a new outbound call by POST'ing to the Calls resource */
$response = $client->request("/$ApiVersion/Accounts/".$_POST['AccountSid']."/Calls",
"POST", array(
"Caller" => "347-632-0269",
"Called" => trim($_POST['Phone']),
"Url" => $FolderPath. "/twilio.xml"
));
if($response->IsError) {
echo "Error: {$response->ErrorMessage}";
}
else {
echo "Started call: {$response->ResponseXml->Call->Sid}";
}
}
else {
echo "You don't belong here!";
}
}
else {
echo "Wrong vars";
}
?>