# HG changeset patch # User Nicholas Jillings # Date 1484824804 0 # Node ID f41389149eaba5ba36da94e575e72176d83cf5f4 # Parent e3cf3c24149eee8ef37ff121002239489c81ae70 #49: Embed the test file into the initial save. diff -r e3cf3c24149e -r f41389149eab php/requestKey.php --- a/php/requestKey.php Thu Jan 19 10:47:42 2017 +0000 +++ b/php/requestKey.php Thu Jan 19 11:20:04 2017 +0000 @@ -16,6 +16,12 @@ header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); +// Get the current test URL +$testURL = ""; +if (isset($_GET['url'])) { + $testURL = $_GET["url"]; +} + $saves = glob("../saves/*.xml"); $key = ""; @@ -44,18 +50,21 @@ $filename = "../saves/save-".$key.".xml"; $fileHandle = fopen($filename, 'w'); if ($fileHandle == FALSE) { - echo "ERROR".$key."Could not open file for writing"; - return; + die("ERROR".$key."Could not open file for writing"); } fclose($fileHandle); // TODO: // Generate the XML Base file and save it $doc_struct = new SimpleXMLElement(''); $doc_struct->addAttribute("key",$key); +// Add the root +if (file_exists($testURL)) { + $test_proto = new SimpleXMLElement(file_get_contents($testURL, FILE_TEXT)); + $doc_struct->addChild($test_proto); +} // Add start time // Add IP Address information // Save the file $doc_struct->asXML($filename); echo "OK".$key.""; -return; ?>