回答編集履歴
1
追記
test
CHANGED
@@ -33,3 +33,73 @@
|
|
33
33
|
\Log::debug("CurlTest:" . $httpCode );
|
34
34
|
|
35
35
|
```
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
# 以下追記
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
CA証明書がないエラーが発生する場合がある時の対応
|
46
|
+
|
47
|
+
一旦試してもらえますか?
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
```
|
52
|
+
|
53
|
+
composer require composer/ca-bundle
|
54
|
+
|
55
|
+
```
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
```php
|
60
|
+
|
61
|
+
$ch = curl_init();
|
62
|
+
|
63
|
+
curl_setopt( $ch, CURLOPT_URL, "https://www.google.com" );
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
$caPathOrFile = \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath();
|
68
|
+
|
69
|
+
if (is_dir($caPathOrFile) || (is_link($caPathOrFile) && is_dir(readlink($caPathOrFile)))) {
|
70
|
+
|
71
|
+
curl_setopt($curl, CURLOPT_CAPATH, $caPathOrFile);
|
72
|
+
|
73
|
+
} else {
|
74
|
+
|
75
|
+
curl_setopt($curl, CURLOPT_CAINFO, $caPathOrFile);
|
76
|
+
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
82
|
+
|
83
|
+
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, FALSE);
|
84
|
+
|
85
|
+
curl_setopt( $ch, CURLOPT_TIMEOUT, 5 );
|
86
|
+
|
87
|
+
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
|
88
|
+
|
89
|
+
if( ! $result = curl_exec($ch)) {
|
90
|
+
|
91
|
+
\Log::debug("CurlError:" . curl_error($ch));
|
92
|
+
|
93
|
+
}
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
98
|
+
|
99
|
+
curl_close( $ch );
|
100
|
+
|
101
|
+
\Log::debug("CurlTest:" . $httpCode );
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
```
|