Created
March 30, 2016 12:51
-
-
Save BlackDante/c927185496becef6534c60740d56555b 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
<?php | |
if (isset($_GET['origin'])) { | |
switch($_GET['origin']) { | |
case '*': | |
header("Access-Control-Allow-Origin: *"); | |
break; | |
case 'www': | |
$server = isset($_SERVER['HTTP_REFERER']) ? "http://" . parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST) : null; | |
header("Access-Control-Allow-Origin: $server"); | |
break; | |
} | |
} | |
echo json_encode(['status' => 'ok']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment