基本的に、特定のレポのタグを取得し、結果をphp配列に配置する必要があります
私はgithub APIを見てきました。タグの配列を返しますが、cURL の経験はありません。
URLはhttps://api.github.com/repos/joshf/MYREPO/git/refs/tagになると思いますが、答えを配列に入れる方法がわかりません
GitHub API の v2 のガイドは見つかりましたが、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 ビットだけです