Github authentication with deprecated endpoint not working

Hi all below is my code. Please let me know if any changes needed and why it is not working.


$ch = curl_init();

$arr[‘access_token’] = ‘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’;

curl_setopt($ch, CURLOPT_URL, ‘’);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, ‘POST’);

curl_setopt($ch, CURLOPT_USERAGENT, ‘ce5008134ff522551166’);

curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($arr));

$headers = array();

$headers = ‘Accept: application/vnd.github.v3+json’;

$headers = ‘Content-Type: application/x-www-form-urlencoded’;

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
echo ‘Error:’ . curl_error($ch);