回答編集履歴

1

認証追加

2018/11/20 07:10

投稿

moonphase
moonphase

スコア6621

test CHANGED
@@ -5,6 +5,10 @@
5
5
  ```php
6
6
 
7
7
  $url = "{ここにURL}/v3/translate?version=2018-05-01";
8
+
9
+ $user = "apikey";
10
+
11
+ $pass = "{ここにAPI鍵}";
8
12
 
9
13
  $options = array(
10
14
 
@@ -36,6 +40,8 @@
36
40
 
37
41
  curl_setopt($ch, CURLOPT_URL, $url);
38
42
 
43
+ curl_setopt($ch, CURLOPT_USERPWD, $user . ":" . $pass);
44
+
39
45
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
40
46
 
41
47
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);