made some progress and load my xml data straiight into a variable via file_get_contents() as desired.For testing I had my DOM object reading a XML file, which also works nicely.
Questions: how can I change the DOM to take the variable from the file_get_contents() instead of a file?
Code reading in XML file, which now needs to take a variable
$objDOM = new DOMDocument();
$objDOM->preserveWhiteSpace = FALSE;
//$objDOM->load($request_url);
if(!$objDOM->load($request_url)) {
die("<P>--> Error opening xml file</P>");
}
Code pieces grabbing XML
// submit action to get XML data in to variable
if ($_POST){
echo "<P>User Has submitted the form</P>"; // TODO: Delete this
$postdata = http_build_query($_POST); //http_build_query — Generate URL-encoded query string for passing the POST data
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata
)
);
$context = stream_context_create($opts);
$StarCiteOutput = file_get_contents('https://www.seeuthere.com/sut/respond.asp',false,$context);
echo "<P>My Result: $StarCiteOutput</P>"; // TODO: Delete this
// Validate starcite output
$test = strpos($StarCiteOutput, "sut.respond.error");
if (strpos($StarCiteOutput, "sut.respond.error") > 0){
die("<B>Error obtaining XML from StarCite:</B> $StarCiteOutput");
}
else {
//Start Processing the XML result
require('processing.xml.inc.php');
}
}