我在访问一些基本配置文件字段时收到 401 ssl required for likedin rest api 错误

I am getting 401 ssl required error for likedin rest api while accessing some basic profile fields

我正在使用 rest api 通过 php 代码从 linkedin 获取基本配置文件数据。我能够成功生成访问代码和访问令牌,但每当我尝试使用以下 url 获取基本配置文件时,我都会收到 ssl required 错误 https://api.linkedin.com/v1/people/~?format=json

我按照此处列出的所有步骤发出经过身份验证的请求https://developer.linkedin.com/docs/oauth2

我正在使用非ssl url作为回调参数,是否有必要使用ssl url?如果不是那么为什么我会收到此错误。 寻找解决方案

下面是获取配置文件字段的代码

$host = "api.linkedin.com";
$path = "/v1/people/~)";
//$arr = array('oauth2_access_token' => $access['access_token']);
$token = $access['access_token'];

  $header[] = "Authorization: Bearer ".$token;
  $header[] = "Connection: keep-alive"; 
  $header[] = "Keep-Alive: 300";


$ch = curl_init();

// endpoint url
curl_setopt($ch, CURLOPT_URL, $host . $path);

// set request as regular post
//curl_setopt($ch, CURLOPT_HTTPGET, true);

// set http version
curl_setopt($ch, CURLOPT_HTTP_VERSION, 'HTTP/1.1');

// set data to be send
//curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($arr));

// set header
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

// set header
curl_setopt($ch, CURLOPT_CERTINFO, true);

// return transfer as string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

curl_close($ch);

var_export($response);

我的解决方案是使用 https:// 而不是 http://