質問するログイン新規登録

質問編集履歴

6

微修正

2018/01/25 13:07

投稿

T-Moriyama
T-Moriyama

スコア11

title CHANGED
File without changes
body CHANGED
@@ -11,7 +11,7 @@
11
11
  で発信するとシェルスクリプトがエラーを吐いて機能しない
12
12
  ```
13
13
  (apache2のエラーログ)
14
- [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
14
+ [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
15
15
  sh: 1: Syntax error: Unterminated quoted string
16
16
  ```
17
17
  ```
@@ -44,6 +44,11 @@
44
44
  var_dump($output);
45
45
  ?>
46
46
  ```
47
+ ```
48
+ 上記の結果
49
+ $ cat /var/www/html/php_input.txt
50
+ -d "mode=冷房&temp=26&button=power-on"
51
+ ```
47
52
  ```bash
48
53
  #!/bin/sh
49
54
 

5

PHPのソースを修正

2018/01/25 13:06

投稿

T-Moriyama
T-Moriyama

スコア11

title CHANGED
File without changes
body CHANGED
@@ -20,10 +20,20 @@
20
20
  ```
21
21
  ###該当のソースコード
22
22
  ```PHP
23
+ // 2018/1/25 22:00 修正しました。
23
24
  <?php
24
25
 
26
+ $mode = isset($_POST["mode"])?$_POST["mode"]:"暖房";
27
+ $temp = isset($_POST["temp"])?$_POST["temp"]:"24";
28
+ $button = isset($_POST["button"])?$_POST["button"]:"power-off";
29
+
30
+ $json_string = file_get_contents('php://input');
31
+ $filename = "php_input.txt";
32
+
33
+ file_put_contents($filename, $json_string, FILE_APPEND);
34
+
35
+ $mode = $_POST["mode"];
25
36
  $temp = $_POST["temp"];
26
- $mode = $_POST["mode"];
27
37
  $button = $_POST["button"];
28
38
 
29
39
  echo $temp,$mode,$button;

4

微修正

2018/01/25 13:00

投稿

T-Moriyama
T-Moriyama

スコア11

title CHANGED
File without changes
body CHANGED
@@ -17,7 +17,7 @@
17
17
  ```
18
18
  (ブラウザから http://{myurl}/aircon.php で表示される項目)
19
19
  NULL NULL NULL string(178) " エアコンを モードで 度の 風向き 風量 で起動!! {"temp":"0","mode":"auto","vol":"auto","dir":"auto","button":"","updated_at":"2018-01-24T04:44:37Z"}"
20
-
20
+ ```
21
21
  ###該当のソースコード
22
22
  ```PHP
23
23
  <?php

3

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

2018/01/24 04:50

投稿

T-Moriyama
T-Moriyama

スコア11

title CHANGED
File without changes
body CHANGED
@@ -14,6 +14,9 @@
14
14
  [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
15
15
  sh: 1: Syntax error: Unterminated quoted string
16
16
  ```
17
+ ```
18
+ (ブラウザから http://{myurl}/aircon.php で表示される項目)
19
+ NULL NULL NULL string(178) " エアコンを モードで 度の 風向き 風量 で起動!! {"temp":"0","mode":"auto","vol":"auto","dir":"auto","button":"","updated_at":"2018-01-24T04:44:37Z"}"
17
20
 
18
21
  ###該当のソースコード
19
22
  ```PHP

2

補足情報追加

2018/01/24 04:49

投稿

T-Moriyama
T-Moriyama

スコア11

title CHANGED
File without changes
body CHANGED
@@ -102,4 +102,5 @@
102
102
  IFTTTでWebhookではなくメールやメッセージに送るアクションだと"暖房 27"などと表示され文字化け無し
103
103
 
104
104
  ###補足情報(言語/FW/ツール等のバージョンなど)
105
- より詳細な情報
105
+ NatureRemo Cloud API
106
+ http://swagger.nature.global/

1

初心者マークの付加

2018/01/23 18:14

投稿

T-Moriyama
T-Moriyama

スコア11

title CHANGED
File without changes
body CHANGED
File without changes