if ($isValid) {
    $cgi = '/cgi-bin';
    if (strpos($HTTP_HOST, 'dyndns') === false) $cgi .= '/cgiwrap/ppowell';
    $fileID = 
fopen("http://$SERVER_NAME$cgi/pollinsert.cgi?pollID=$pollID&answerID=$answerID&valIdentifier=";
 . urlencode($valIdentifier) . "&lastPollResultsID=" . 
($pollResultsArray[sizeOf($pollResultsArray) - 2][attributes][ID] + 1), 'r') 
     or die('Could not open CGI');
    $result = fread($fileID, 100000);
    fclose($fileID);
    if (trim(strtoupper($result)) != 'DONE') die ("Problem with TCL CGI writing to 
file: $result");
    // RE-PARSE XML CONTENTS SINCE ADDING NEW POLL ANSWER
    unset($pollResultsArray); unset($pollResultsXMLStuff);
    $fileID = fopen('/users/ppowell/web/xml/pollresults.xml', 'r') or die('Could not 
reopen file');
    $pollResultsXMLStuff = fread($fileID, 
filesize('/users/ppowell/web/xml/pollresults.xml'));
    fclose($fileID);
    $parser = xml_parser_create();
    xml_parse_into_struct($parser, $pollResultsXMLStuff, $pollResultsArray, $tags);
    xml_parser_free($parser);
   } else {
    // REDIRECT BACK TO POLL IF
    header("Location: http://$SERVER_NAME/poll/poll.php?pollID=$pollID&errorMsg="; . 
urlencode($errorMsg));
   }
   // END OF FORM PLACEMENT

  }

I am making changes to an XML file (and the only way I can, unless anyone knows how in 
PHP I can write TO an XML file!!! is to use a TCL CGI script to write to the XML 
file), once changes have been made I need to reopen the file and read its contents, 
however, every time I do I am getting OLD file information and NOT my changes, every 
single time, unless I refresh my page... 

Does anyone know what I can do about this? I can't redirect them, that would be 
horribly inefficient.. what can I do?

Thanx
Phil

Reply via email to