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,
));
}