-
-
Save aaronpk/5b116bb2fbc1b21fdf3b551b6c9bf949 to your computer and use it in GitHub Desktop.
This file contains 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 | |
// Convert form-encoded request to JSON equivalent | |
if(isset($_POST['h'])) { | |
$h = $_POST['h']; | |
unset($_POST['h']); | |
$input = [ | |
'type' => ['h-'.$h], | |
'properties' => array_map(function($a){ return is_array($a) ? $a : [$a]; }, $_POST) | |
]; | |
} else { | |
$input = json_decode(file_get_contents('php://input'), true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment