Skip to content

Instantly share code, notes, and snippets.

@bzz0217
Last active January 3, 2016 09:43
Show Gist options
  • Save bzz0217/f20dc4000a51221849bf to your computer and use it in GitHub Desktop.
Save bzz0217/f20dc4000a51221849bf to your computer and use it in GitHub Desktop.
github api oauth認証してデータを取得する
<?php
$options = array(
'http'=>array(
'method' => 'GET',
'header' => array(
'Authorization: token [API_TOKEN]',
'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36',
)
)
);
$context = stream_context_create( $options );
$contents = file_get_contents( 'https://api.github.com/users/bzz0217', FALSE, $context );
var_dump($contents);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment