2015-12-29 14 views
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); 

回答

2

我的解决办法是使用https://,而不是仅仅的http://

相关问题