function ArrayFromHttpPut() { # assume a simple PUT, like a PDF form submission
$arrRtn = array(); # init result
$strInp = file_get_contents('php://input'); # PUT data comes in on StdIn, not in GET
$arrInp = explode("\r\n", $strInp, 2); # break input into array by only the first CrLf
$strBnd = $arrInp[0]; # first line of input is content boundary
$strInp = $arrInp[1]; # proceed with remainder of input
$arrInp = explode($strBnd, $strInp); # break input into array by content boundary
foreach ($arrInp as $idxInp => $strInp) { # scan input items
$arrItm = explode("\r\n\r\n", $strInp, 2); # break each item into array by only the first double-blank line
$arrItm[0] = trim($arrItm[0]); # drop spurious leading and trailing
$arrItm[1] = trim($arrItm[1]); # blank lines from both parts
$arrItmNam = explode('=', $arrItm[0]); # break item name away from Content-Disposition wording
$strItmNam = str_replace('"', '', $arrItmNam[1]); # get item name without its enclosing double-quotes
$strItmVal = $arrItm [1] ; # get item value
$arrRtn[$strItmNam] = $strItmVal; # append (item-name => item-value) to output buffer
} # done with scanning input items
return $arrRtn; # pass result back to caller
} # ArrayFromHttpPut