Skip to content

Instantly share code, notes, and snippets.

View ats's full-sized avatar

Alan Schussman ats

View GitHub Profile
@ats
ats / media-endpoint.php
Last active March 5, 2018 03:42 — forked from aaronpk/media-endpoint.php
an example of a Micropub Media Endpoint https://www.w3.org/TR/micropub/#media-endpoint
<?php
$token_endpoint = 'https://tokens.indieauth.com/token';
$base_url = 'https://media.prettygoodhat.com/';
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Authorization');
if(isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'text/plain') !== false) {
$format = 'text';