如何从PHP中的github url获取特定的存储库信息?

时间:2015-08-18 18:53:39

标签: php curl github github-api

我希望使用curl获取特定的存储库信息。

假设我的GitHub repo url如下:

https://github.com/githubexample/Example-Repository

现在,当我将此网址放入我的输入表单并提交结果时,它将显示此存储库的标题和说明。

我该怎么做?

1 个答案:

答案 0 :(得分:1)

似乎您可能对此链接感兴趣。

https://developer.github.com/v3/repos/#get

使用curl,您可以向

发送GET请求

GET /repos/:username/:repo

这准确描述了您的目标。

示例:curl -i https://api.github.com/repos/octocat/Hello-World

这将返回包含“name”和“description”的json文档。

编辑:添加了更好的信息和示例。

相关问题