-1
基本上我需要得到標籤爲一個給定的回購協議,並將結果存放在一個PHP數組獲取GitHub的標籤爲PHP數組
我見過github API; returning an array of tags但我有捲曲的經驗。
我覺得這個網址被https://api.github.com/repos/joshf/MYREPO/git/refs/tag但我不知道怎麼去回答到一個數組
我發現了一個指南GitHub的API第2而不是V3
任何幫助將理解
編輯:
<?php
$url = "https://api.github.com/repos/joshf/Burden/git/refs/tags";
$ch=curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "test");
$r=curl_exec($ch);
curl_close($ch);
echo $r;
$response_array = json_decode($r, true);
echo $response_array->{"ref"};
?>
給我
[{"ref":"refs/tags/1.2","url":"https://api.github.com/repos/joshf/Burden/git/refs/tags/1.2","object":{"sha":"d04eabe44b52e65ca2e1c1eaaca4321195d85001","type":"tag","url":"https://api.github.com/repos/joshf/Burden/git/tags/d04eabe44b52e65ca2e1c1eaaca4321195d85001"}},{"ref":"refs/tags/1.3","url":"https://api.github.com/repos/joshf/Burden/git/refs/tags/1.3","object":{"sha":"74d40e3f89717cbadc11e23e8ab4350d85deb015","type":"tag","url":"https://api.github.com/repos/joshf/Burden/git/tags/74d40e3f89717cbadc11e23e8ab4350d85deb015"}}]
所有我想要的是1.2和1.3位標籤
那你嘗試至今?你可能想從[**'curl documentation' **](http://www.php.net/manual/en/function.curl-init.php) – Fabio
我試過[this](http:// davidwalsh.name/github-markdown) –
好吧,改善你的問題,包括你的代碼,並告訴我們你在哪裏發現問題 – Fabio