tag_name; $currentTag = $_GET["tag"]; // return latest version if no ?tag=XXXX if (empty($currentTag)){ echo $latestTag; } if (($latestTag != $currentTag) && ($currentTag!=NULL)) { $binPath = $json->assets[0]->browser_download_url; // the file you want to send $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $binPath); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $out = curl_exec($ch); curl_close($ch); // Set header for binary header('Content-type: application/octet-stream'); header('Content-disposition: attachment; filename="firmware.bin"'); header('Content-Transfer-Encoding: binary'); header("Content-Length: ".strlen($out)); echo $out; } exit(); ?>