Created
May 17, 2023 10:33
-
-
Save Cyclonecode/df2555edc2f5e1be7ebe9507991495f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # get repository content | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_URL, "https://api.github.com/repos/$this->username/$this->repository/contents/README.md"); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
| curl_setopt($ch, CURLOPT_HTTPHEADER, [ | |
| 'Accept: application/vnd.github+json', | |
| 'X-Github-Api-Version: 2022-11-28', | |
| 'Authorization: Bearer ' . $this->token, | |
| ]); | |
| curl_setopt($ch, CURLOPT_USERAGENT, 'my-user-agent'); | |
| $response = curl_exec($ch); | |
| $response = \json_decode($response); | |
| $readmeContent = base64_decode($response->content); | |
| # get tags | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_URL, "https://api.github.com/repos/$this->username/$this->repository/tags"); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
| curl_setopt($ch, CURLOPT_HTTPHEADER, [ | |
| 'Accept: application/vnd.github+json', | |
| 'X-Github-Api-Version: 2022-11-28', | |
| 'Authorization: Bearer ' . $this->token, | |
| ]); | |
| curl_setopt($ch, CURLOPT_USERAGENT, 'my-user-agent'); | |
| $response = curl_exec($ch); | |
| $response = \json_decode($response); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment