Skip to content

Instantly share code, notes, and snippets.

View terribleplan's full-sized avatar

terribleplan terribleplan

View GitHub Profile
@terribleplan
terribleplan / gist:10478411
Last active August 29, 2015 13:59
XDR workaround
<?
//Check that the request is a POST, sent by ie8/9 and DOESN'T have a content-type with the request
if ($_SERVER['REQUEST_METHOD'] == "POST" && (bool)preg_match('/msie (8|9)./i', $_SERVER['HTTP_USER_AGENT']) && !isset($_SERVER['CONTENT_TYPE'])) {
//And parse it into the $_POST superglobal
parse_str(file_get_contents('php://input'), $_POST);
}
?>
@terribleplan
terribleplan / prettyjsonandp.php
Last active December 25, 2015 17:59
This /should/ parse json(p) into a nice readable format
#!/usr/bin/env php
<?php
print("\n");
//read from stdin
$rawdata = fgets(STDIN);
//pull out the callback from a jsonp request
$temp = explode('(', $rawdata, 2);
//check if the response is jsonp or not
$callback = false;