Skip to content

Instantly share code, notes, and snippets.

@vishnukumarpv
Last active February 20, 2023 09:33
Show Gist options
  • Save vishnukumarpv/8562a0dcfc367c0fdce1b82cb263a853 to your computer and use it in GitHub Desktop.
Save vishnukumarpv/8562a0dcfc367c0fdce1b82cb263a853 to your computer and use it in GitHub Desktop.
CURL php Auth get data LinkedIn
<?php
function post_curl($url,$param="")
{
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
if($param!="")
curl_setopt($ch,CURLOPT_POSTFIELDS,$param);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$url = 'https://www.linkedin.com/uas/oauth2/accessToken';
$url = 'https://www.linkedin.com/uas/oauth2/accessToken';
$param = 'grant_type=authorization_code&code='.$_GET['code'].'&redirect_uri='.$config['callback_url'].'&client_id='.$config['Client_ID'].'&client_secret='.$config['Client_Secret'];
$return = (json_decode(post_curl($url,$param),true));
// $param = 'grant_type=authorization_code&code='.$_GET['code'].'&redirect_uri='.$config['callback_url'].'&client_id='.$config['Client_ID'].'&client_secret='.$config['Client_Secret'];
print_r(post_curl());
// https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=815ynd63qiyx&redirect_uri=http://dev.localhost/&state=98765EeFWf45A53sdfKef4233&scope=r_basicprofile r_emailaddress
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment