<?php
require_once("config.php");
$year = htmlspecialchars($_GET["year"]);
//ebb: when I change this to $_POST, I generate an HTML page with the h1 element, but no PHP generated output.
$url = REST_PATH . "/db/queries/postLetterList.xql?year=$year";
$data = array('type' => 'input', 'target' => $year);
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
?>
<?php
require_once("config.php");
$uri = htmlspecialchars($_POST["uri"]);
$contents = REST_PATH . "/db/queries/letterText.xql?uri=$uri";
$data = array('type' => 'input', 'target' => $uri);
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($contents, false, $context);
echo $result;
?>
With this, I generate an HTML page with the h1 element, and evidently part of my XQuery script is firing, but failing to retrieve the "uri" parameter, because I generate PART of the transformed XSLT file but the letter is missing! The XSLT is evidently firing to produce the basic template of the page but fails to retrieve and transform the XML file.
And once again, if I change the value of $uri to include $_GET instead of $_POST, I do successfully retrieve the XML file and the value of $uri appears in the browser.