0
我正在使用rest api從linkedin獲取基本的配置文件數據。我能夠成功地生成訪問代碼和訪問令牌,但我越來越需要SSL錯誤,每當我試着使用,以獲得基本的輪廓以下網址 https://api.linkedin.com/v1/people/~?format=json我在訪問一些基本的配置文件字段時得到了401個ssl需要的錯誤,在進入一些基本的配置文件字段時
我執行了所有步驟,使身份驗證請求作爲上市有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);