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

質問編集履歴

3

curl.phpのデバッグ結果を追加しました。

2015/05/27 01:32

投稿

usugita_san
usugita_san

スコア228

title CHANGED
File without changes
body CHANGED
@@ -49,4 +49,33 @@
49
49
 
50
50
  の処理に入ってました。
51
51
  404エラーとなっていたのは例外処理の結果らしく、根本的にはこのset_responseあたりに問題があるんじゃないかと思っています。
52
- 引き続き調べてみます。
52
+ 引き続き調べてみます。
53
+
54
+
55
+ さらに追記です。
56
+
57
+ curl.php の executeメソッドで、
58
+
59
+ ```lang-php
60
+ $body = curl_exec($connection);
61
+ ```
62
+
63
+ の結果、$bodyが空になっていました。
64
+
65
+ その数行手前で、
66
+
67
+ ```lang-php
68
+ curl_setopt_array($connection, $this->options);
69
+ ```
70
+ の時点で、$this->options の内容をログに出力した所、以下のようになりました。
71
+
72
+ > (
73
+ > [> 64] =>
74
+ > [13] => 30
75
+ > [19913] => 1
76
+ > [45] =>
77
+ > [52] => 1
78
+ > [10036] => POST
79
+ > [47] => 1
80
+ > [10015] => param_name=hogehoge1&param_name2=hogehoge2
81
+ > )

2

404エラーは、例外処理の結果だという事が分かりましたので、追記しました。

2015/05/27 01:32

投稿

usugita_san
usugita_san

スコア228

title CHANGED
File without changes
body CHANGED
@@ -30,4 +30,23 @@
30
30
  このような現象に、どなたか心当たりが無いでしょうか?
31
31
 
32
32
  curlをコマンドで打つとリクエストが届くので、セキュリティグループの問題ではないと考えています。
33
- FuelPHPの内部的な問題ではないかと思っていますが、configファイルは数週間変更しておりません。
33
+ FuelPHPの内部的な問題ではないかと思っていますが、configファイルは数週間変更しておりません。
34
+
35
+ 追記です。
36
+ Fuel\Core\classes\requestのcurl.phpで、executeメソッドの中を見てみると、
37
+ ```lang-php
38
+ $this->set_response($body, $this->response_info('http_code', 200), $mime, $headers, isset($this->headers['Accept']) ? $this->headers['Accept'] : null);
39
+ ```
40
+ という処理の後で、
41
+
42
+ ```lang-php
43
+ if ($body === false)
44
+ {
45
+ $this->set_defaults();
46
+ throw new \RequestException(curl_error($connection), curl_errno($connection));
47
+ }
48
+ ```
49
+
50
+ の処理に入ってました。
51
+ 404エラーとなっていたのは例外処理の結果らしく、根本的にはこのset_responseあたりに問題があるんじゃないかと思っています。
52
+ 引き続き調べてみます。

1

httpをhttpsに変更しました。

2015/05/27 01:18

投稿

usugita_san
usugita_san

スコア228

title CHANGED
File without changes
body CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
  ```lang-php
7
- $url = "http://hogehoge.net/hoge/api/login"
7
+ $url = "https://hogehoge.net/hoge/api/login"
8
8
  $request = \Request::forge($url, 'curl');
9
9
  $request->set_option(CURLOPT_SSL_VERIFYPEER, false);
10
10
  $request->set_method('post');
@@ -17,7 +17,7 @@
17
17
  その結果h,curlを投げた結果が404で帰ってきました。
18
18
  FuelPHPのログに以下のようにログがありました。
19
19
 
20
- > INFO - 2015-05-26 10:06:34 --> Fuel\Core\Request_Curl::__construct - Creating a new CURL Request with URI = "http://hogehoge.net/hoge/api/login"
20
+ > INFO - 2015-05-26 10:06:34 --> Fuel\Core\Request_Curl::__construct - Creating a new CURL Request with URI = "https://hogehoge.net/hoge/api/login"
21
21
  > INFO - 2015-05-26 10:06:34 --> Fuel\Core\Request::__construct - Creating a new main Request with URI = "error/404"
22
22
  > INFO - 2015-05-26 10:06:34 --> Fuel\Core\Request::execute - Called
23
23
  > INFO - 2015-05-26 10:06:34 --> Fuel\Core\Request::execute - Setting main Request