Skip to content

Instantly share code, notes, and snippets.

@MSeven
Created June 18, 2009 14:50
Show Gist options
  • Save MSeven/131933 to your computer and use it in GitHub Desktop.
Save MSeven/131933 to your computer and use it in GitHub Desktop.
<?php
private function query($method, $authorized = false) {
if ($authorized) {
$context = stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => sprintf("Content-type: application/x-www-form-urlencoded\r\n"),
'content' => http_build_query(array(
'login' => $this->username,
'token' => $this->token
)),
'timeout' => 5
)
));
} else {
$context = null;
}
return file_get_contents('http://github.com/api/v2/yaml/' . $method, false, $context);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment