将GitHub标记添加到PHP数组中

Basically i need to get the tags for a given repo and place the result in a php array

I've seen github API; returning an array of tags but i have no experience with cURL.

I think the url would be https://api.github.com/repos/joshf/MYREPO/git/refs/tag but i'm not sure how to get the answer into an array

I found a guide for v2 of the GitHub API but not for v3

Any help would be appreciated

EDIT:

<?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"};

?>

Gives me

[{"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"}}]

All i want is the 1.2 and 1.3 bit of the tags

You can decode your response to an associated array with json_decode function, passing association as true

 $resonse_array = json_decode($content, true);