1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | <?php $org = 'pear'; require 'HTTP2.php'; $url = 'https://api.github.com/orgs/' . $org . '/repos'; $cloneUrls = array(); do { $json = json_decode(file_get_contents($url)); $url = null; foreach ($json as $repo) { $cloneUrls[] = $repo->clone_url; } if (isset($http_response_header)) { foreach ($http_response_header as $line) { if (substr(strtolower($line), 0, 5) == 'link:') { $links = HTTP2::parseLinks(substr($line, 5)); foreach ($links as $link) { if (array_search('next', $link['rel']) !== false) { $url = $link['_uri']; } } } } } } while ($url != null); foreach ($cloneUrls as $cloneUrl) { echo $cloneUrl . "\n"; } ?> |