Add api call to gitea for resume (#2)

Resolves #1

Co-authored-by: Tyler Perkins <tperki17@kent.edu>
Reviewed-on: tyler/site#2
This commit is contained in:
Tyler Perkins 2022-12-02 01:35:35 +00:00
parent d1700f7592
commit 7e8d7eedd2
2 changed files with 29 additions and 1 deletions

View File

@ -2,7 +2,7 @@
<link rel="stylesheet" href="/common/header.css">
<nav class="navbar sticky">
<a href="/">Home</a>
<a href="/Resume.pdf">Resume</a>
<a href="/resume.php">Resume</a>
<a href="https://git.clortox.com">Git</a>
<a href="/utilities/">Utilities</a>
<a href="https://wiki.clortox.com">Wiki</a>

28
src/resume.php Normal file
View File

@ -0,0 +1,28 @@
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://git.clortox.com/api/v1/repos/tyler/Resume/releases?per_page=1&access_token=96428d4ddade9a5c0892c9bceb423ce54013bf07");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
if(!$result){
header('HTTP/1.1 500 Internal Server Error');
die();
}
$parsed = json_decode($result, true);
//var_dump($parsed[0]);
$url = $parsed[0]["assets"][0]["browser_download_url"];
if(!$url){
header('HTTP/1.1 500 Internal Server Error');
die();
}
header('Location: ' . $url);
die();
?>