1
當我嘗試使用LinkedIn API對用戶進行身份驗證時,出現這個奇怪的錯誤。一個var_dump()的數據顯示:LinkedIn API PHP
string(156) "{"error_description":"missing required parameters, includes an invalid parameter value, parameter more than once. : ssl required","error":"invalid_request"}"
我不知道爲什麼發生這種情況,任何人都可以幫我解決這個問題。
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.linkedin.com/uas/oauth2/accessToken?");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/x-www-form-urlencoded',
));
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
'grant_type' => 'authorization_code',
'client_id' => $account['linkedin']['api_key'],
'client_secret' => $account['linkedin']['api_secret'],
'code' => $_GET['code'],
'redirect_uri' => get_admin_url() . 'admin.php?page=' . self::$accounts_dashboard_page . '&linkedin=authorization&account=' . urlencode($account['id']),
));
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);