質問編集履歴

6

微修正

2018/01/25 13:07

投稿

T-Moriyama
T-Moriyama

スコア11

test CHANGED
File without changes
test CHANGED
@@ -24,7 +24,7 @@
24
24
 
25
25
  (apache2のエラーログ)
26
26
 
27
- [Wed Jan 24 02:00:47.277031 2018] [:error] [pid 559] [client xxx.xxx.xxx.xxx:xxxxx] PHP Notice: Undefined index: temp in /var/www/html/aircon.php on line 3
27
+ [Thu Jan 25 22:03:01.529499 2018] [:error] [pid 8463] [client 34.201.45.176:34242] PHP Notice: Undefined index: mode in /var/www/html/aircon.php on line 12
28
28
 
29
29
  sh: 1: Syntax error: Unterminated quoted string
30
30
 
@@ -90,6 +90,16 @@
90
90
 
91
91
  ```
92
92
 
93
+ ```
94
+
95
+ 上記の結果
96
+
97
+ $ cat /var/www/html/php_input.txt
98
+
99
+ -d "mode=冷房&temp=26&button=power-on"
100
+
101
+ ```
102
+
93
103
  ```bash
94
104
 
95
105
  #!/bin/sh

5

PHPのソースを修正

2018/01/25 13:06

投稿

T-Moriyama
T-Moriyama

スコア11

test CHANGED
File without changes
test CHANGED
@@ -42,14 +42,34 @@
42
42
 
43
43
  ```PHP
44
44
 
45
+ // 2018/1/25 22:00 修正しました。
46
+
45
47
  <?php
46
48
 
47
49
 
48
50
 
51
+ $mode = isset($_POST["mode"])?$_POST["mode"]:"暖房";
52
+
53
+ $temp = isset($_POST["temp"])?$_POST["temp"]:"24";
54
+
55
+ $button = isset($_POST["button"])?$_POST["button"]:"power-off";
56
+
57
+
58
+
59
+ $json_string = file_get_contents('php://input');
60
+
61
+ $filename = "php_input.txt";
62
+
63
+
64
+
65
+ file_put_contents($filename, $json_string, FILE_APPEND);
66
+
67
+
68
+
69
+ $mode = $_POST["mode"];
70
+
49
71
  $temp = $_POST["temp"];
50
72
 
51
- $mode = $_POST["mode"];
52
-
53
73
  $button = $_POST["button"];
54
74
 
55
75
 

4

微修正

2018/01/25 13:00

投稿

T-Moriyama
T-Moriyama

スコア11

test CHANGED
File without changes
test CHANGED
@@ -36,7 +36,7 @@
36
36
 
37
37
  NULL NULL NULL string(178) " エアコンを モードで 度の 風向き 風量 で起動!! {"temp":"0","mode":"auto","vol":"auto","dir":"auto","button":"","updated_at":"2018-01-24T04:44:37Z"}"
38
38
 
39
-
39
+ ```
40
40
 
41
41
  ###該当のソースコード
42
42
 

3

エラーメッセージ等を編集

2018/01/24 04:50

投稿

T-Moriyama
T-Moriyama

スコア11

test CHANGED
File without changes
test CHANGED
@@ -30,6 +30,12 @@
30
30
 
31
31
  ```
32
32
 
33
+ ```
34
+
35
+ (ブラウザから http://{myurl}/aircon.php で表示される項目)
36
+
37
+ NULL NULL NULL string(178) " エアコンを モードで 度の 風向き 風量 で起動!! {"temp":"0","mode":"auto","vol":"auto","dir":"auto","button":"","updated_at":"2018-01-24T04:44:37Z"}"
38
+
33
39
 
34
40
 
35
41
  ###該当のソースコード

2

補足情報追加

2018/01/24 04:49

投稿

T-Moriyama
T-Moriyama

スコア11

test CHANGED
File without changes
test CHANGED
@@ -206,4 +206,6 @@
206
206
 
207
207
  ###補足情報(言語/FW/ツール等のバージョンなど)
208
208
 
209
- より詳細な情報
209
+ NatureRemo Cloud API
210
+
211
+ http://swagger.nature.global/

1

初心者マークの付加

2018/01/23 18:14

投稿

T-Moriyama
T-Moriyama

スコア11

test CHANGED
File without changes
test CHANGED
File without changes