2

I use knplabs/github-api and I need check exist repository but in this bundle I not find something like that, I try:

$branches = $client->repo()->branches($repository['owner']['login'], $repository['name']);

and where $branches = array(0) I know this repo empty, because If create repo automatic create branch master. This is right ?

And I try

$readme = $client->api('repo')->contents()->readme('knp-labs', 'php-github-api', $reference);

but when not find I have global error not property $readmy == false

And try with curl I have url this url = https://github.com/akmil/pashabrunch1 and when get this url I have status code 204, but $httpCode = 200 and in $header I have 200 why?

            $url = $repository['html_url'];

            $handle = curl_init($repository['html_url']);
            curl_setopt($handle,  CURLOPT_RETURNTRANSFER, TRUE);

            /* Get the HTML or whatever is linked in $url. */
            $response = curl_exec($handle);

            /* Check for 404 (file not found). */
            $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);

            $header = get_headers($repository['html_url'], 1);
shuba.ivan
  • 3,375
  • 7
  • 32
  • 104
  • You can find another ways to do it here: http://stackoverflow.com/questions/23914896/check-that-git-repository-exists – mloureiro Jan 12 '16 at 15:20

0 Answers0