Add soundcloud callback file for saas routing

This commit is contained in:
Duncan Sommerville 2015-06-17 17:39:37 -04:00
parent 627343a626
commit 080c2c43b5
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
<?php
class Router {
/**
* Parse the URL query string and store the key->val pairs
* into an array, then redirect
*/
public function reroute() {
$params = array();
parse_str($_SERVER['QUERY_STRING'], $params);
$this->_redirect($params);
}
/**
* Redirect to the URL passed in the 'state' parameter
* when we're redirected here from SoundCloud
*
* @param $params array array of URL query parameters
*/
private function _redirect($params) {
$url = urldecode($params['state']);
header("Location: $url?" . $_SERVER['QUERY_STRING']);
}
}
(new Router())->reroute();