Skip to content

Instantly share code, notes, and snippets.

@markbalt
Created February 26, 2013 15:23
Show Gist options
  • Save markbalt/5039253 to your computer and use it in GitHub Desktop.
Save markbalt/5039253 to your computer and use it in GitHub Desktop.
Generates summary of open tickets in a milestone using Github API/cURL
<?php
date_default_timezone_set('America/New_York');
error_reporting(E_ALL);
ini_set("display_errors", "1");
$username = '';
$password = '';
$request = array(
"state" => "open",
"milestone" => "22"
);
$c = curl_init("https://api.github.com/repos/Expedient/SMC/issues?".http_build_query($request));
curl_setopt($c, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($c, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($c, CURLOPT_TIMEOUT, 30);
curl_setopt($c, CURLOPT_HTTPGET, 1);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($c, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($c, CURLOPT_SSL_VERIFYPEER, 0);
$return = curl_exec($c);
if ($return === false) {
die("Error #".curl_errno($c).": ".curl_error($c));
}
echo "<ul>\n";
foreach (json_decode($return) as $thing) {
echo "<li>";
echo "<a href=\"".$thing->html_url."\">".$thing->number."</a> - ".$thing->title."<br />";
echo $thing->body."<br />";
echo "</li>\n";
}
echo "</ul>\n";
curl_close($c);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment