0
我想列出GitHub存储库。我可以在浏览器中显示JSON,但是当我尝试加载一个API页面,我得到一个403错误:403使用存储库搜索API时禁止使用
Warning: file_get_contents(https://api.github.com/search/repositories?q=user:<username>): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
我的功能如下:
public function repoListAction()
{
$repositories = json_decode(file_get_contents('https://api.github.com/search/repositories?q=user:<put your username here>'), true);
return $this->render('full/repolist.html.twig', array(
'repositories' => $repositories,
));
}