-
Notifications
You must be signed in to change notification settings - Fork 22
/
index.php
40 lines (33 loc) · 1.23 KB
/
index.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
<?php
include_once("alexa.php");
include_once("xboxon.php");
$Alexa = new Alexa();
$Xbox = new XboxOn();
// Set alexa app specific data
$Alexa->setApplicationID("amzn1.ask.skill.12345678-1234-1234-1234-123456789123"); // Set the application ID for your skill here
$Alexa->setApplicationName("Xbox On"); // Change this to whatever you are calling your app
// Set Xbox IP address and live ID
$Xbox->setIPAddress("123.456.654.321"); // Set the public IP address of your Xbox here
$Xbox->setXboxLiveID("ABCD1234ABCD1234"); // Set the Xbox live ID here
// Authenticate request and execute
if($Alexa->auth()) {
if($Xbox->ping()) {
$Alexa->setCard("Xbox is already on.");
$Alexa->setReprompt("");
$Alexa->setOutputSpeech("Your xbox has already been turned on.");
}
else {
if($Xbox->switchOn()) {
$Alexa->setCard("Xbox is now on.");
$Alexa->setReprompt("");
$Alexa->setOutputSpeech("Your xbox is now turned on.");
}
else {
$Alexa->setCard("Xbox couldn't be turned on.");
$Alexa->setReprompt("");
$Alexa->setOutputSpeech("Your Xbox could not be turned on. Please try again.");
}
}
$Alexa->displayOutput();
}
?>