我使用knplabs / github-api并且我需要检查存在的存储库但是在这个包中我找不到类似的东西,我尝试:
$branches = $client->repo()->branches($repository['owner']['login'], $repository['name']);
和$ branches = array(0)我知道这个repo为空,因为如果create repo自动创建分支master。这是对的吗?
我试试
$readme = $client->api('repo')->contents()->readme('knp-labs', 'php-github-api', $reference);
但是当没有找到我有全局错误而不是属性$ readmy == false
尝试卷曲 我有url这个网址= https://github.com/akmil/pashabrunch1,当得到这个网址时,我的状态代码为204,但$ httpCode = 200,而在$ header中我有200个为什么?
$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);