在php中传递Http参数显示“Authentication parameter missing”

时间:2017-01-19 19:52:49

标签: php http curl https header

我想发送带有请求的app id和app key以获得json的回复。但是响应总是'缺少身份验证参数。我不知道我错过了什么。我也是php的新手

<?php

$data = array('app_id'=>'123',
          'app_key'=>'123',
'Accept'=>'application/json');
 $query=http_build_query($data);
 $language='en';
     $url="https://odapi.oxforddictionaries.com:443/api/v1/entries/".$language.'/'.'ace';
$curl=curl_init();

curl_setopt($curl, CURLOPT_URL,$url);
curl_setopt ($curl, CURLOPT_POST, 1); 
curl_setopt ($curl, CURLOPT_POSTFIELDS,  http_build_query($data)); 
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
  $x=curl_exec ($curl);
curl_close ($curl);
 ?>

帮助请伙伴们

0 个答案:

没有答案