回答編集履歴
1
認証追加
answer
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
```php
|
4
4
|
$url = "{ここにURL}/v3/translate?version=2018-05-01";
|
5
|
+
$user = "apikey";
|
6
|
+
$pass = "{ここにAPI鍵}";
|
5
7
|
$options = array(
|
6
8
|
CURLOPT_RETURNTRANSFER => true,
|
7
9
|
CURLOPT_FOLLOWLOCATION => true,
|
@@ -17,6 +19,7 @@
|
|
17
19
|
|
18
20
|
$ch = curl_init();
|
19
21
|
curl_setopt($ch, CURLOPT_URL, $url);
|
22
|
+
curl_setopt($ch, CURLOPT_USERPWD, $user . ":" . $pass);
|
20
23
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
|
21
24
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
22
25
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|