Basic Authentication
$ curl -u "username" https://api.github.com
OAuth2 Token (sent in a header)
$ curl -H "Authorization: token OAUTH-TOKEN" https://api.github.com
OAuth2 Token (sent as a parameter)
$ curl https://api.github.com/?access_token=OAUTH-TOKEN
$ch = curl_init ();
curl_setopt ($ch, CURLOPT_URL, 'https://api.github.com');
curl_setopt ($ch, CURLOPT_USERAGENT, 'cURL/php');
curl_setopt ($ch, CURLOPT_USERPWD, 'login:password');
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec ($ch);